[PATCH 5/5] wined3d: Move volume DXTn handling to apply_format_fixups.
Stefan Dösinger
stefan at codeweavers.com
Fri Apr 24 03:33:51 CDT 2015
Note that ARB_internalformat_query2 isn't going to help here. It will
report support for DXTn volumes if GL_NV_texture_compression_vtc is
supported.
---
dlls/d3d8/tests/device.c | 24 ++++--------------------
dlls/d3d9/tests/device.c | 24 ++++--------------------
dlls/wined3d/directx.c | 19 -------------------
dlls/wined3d/utils.c | 16 ++++++++++++++++
4 files changed, 24 insertions(+), 59 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 64c2911..7158cf7 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -5953,7 +5953,7 @@ static void test_volume_blocks(void)
D3DLOCKED_BOX locked_box;
BYTE *base;
INT expected_row_pitch, expected_slice_pitch;
- BOOL support, support_2d;
+ BOOL support;
BOOL pow2;
unsigned int offset, expected_offset;
@@ -5977,9 +5977,6 @@ static void test_volume_blocks(void)
hr = IDirect3D8_CheckDeviceFormat(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8,
0, D3DRTYPE_VOLUMETEXTURE, formats[i].fmt);
support = SUCCEEDED(hr);
- hr = IDirect3D8_CheckDeviceFormat(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8,
- 0, D3DRTYPE_TEXTURE, formats[i].fmt);
- support_2d = SUCCEEDED(hr);
/* Test creation restrictions */
for (w = 1; w <= 8; w++)
@@ -6000,7 +5997,6 @@ static void test_volume_blocks(void)
for (j = 0; j < sizeof(create_tests) / sizeof(*create_tests); j++)
{
BOOL may_succeed = FALSE;
- BOOL todo = FALSE;
if (create_tests[j].need_runtime_support && !formats[i].core_fmt && !support)
expect_hr = D3DERR_INVALIDCALL;
@@ -6009,10 +6005,7 @@ static void test_volume_blocks(void)
else if (pow2 && !size_is_pow2 && create_tests[j].need_driver_support)
expect_hr = D3DERR_INVALIDCALL;
else if (create_tests[j].need_driver_support && !support)
- {
- todo = support_2d;
expect_hr = D3DERR_INVALIDCALL;
- }
else
expect_hr = D3D_OK;
@@ -6028,18 +6021,9 @@ static void test_volume_blocks(void)
if (!formats[i].core_fmt && !support && FAILED(expect_hr))
may_succeed = TRUE;
- if (todo)
- {
- todo_wine ok(hr == expect_hr || ((SUCCEEDED(hr) && may_succeed)),
- "Got unexpected hr %#x for format %s, pool %s, size %ux%ux%u.\n",
- hr, formats[i].name, create_tests[j].name, w, h, d);
- }
- else
- {
- ok(hr == expect_hr || ((SUCCEEDED(hr) && may_succeed)),
- "Got unexpected hr %#x for format %s, pool %s, size %ux%ux%u.\n",
- hr, formats[i].name, create_tests[j].name, w, h, d);
- }
+ ok(hr == expect_hr || ((SUCCEEDED(hr) && may_succeed)),
+ "Got unexpected hr %#x for format %s, pool %s, size %ux%ux%u.\n",
+ hr, formats[i].name, create_tests[j].name, w, h, d);
if (FAILED(hr))
ok(texture == NULL, "Got texture ptr %p, expected NULL.\n", texture);
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 4d48ea8..cb4a6e8 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -8567,7 +8567,7 @@ static void test_volume_blocks(void)
D3DLOCKED_BOX locked_box;
BYTE *base;
INT expected_row_pitch, expected_slice_pitch;
- BOOL support, support_2d;
+ BOOL support;
BOOL pow2;
unsigned int offset, expected_offset;
@@ -8591,9 +8591,6 @@ static void test_volume_blocks(void)
hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8,
0, D3DRTYPE_VOLUMETEXTURE, formats[i].fmt);
support = SUCCEEDED(hr);
- hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8,
- 0, D3DRTYPE_TEXTURE, formats[i].fmt);
- support_2d = SUCCEEDED(hr);
/* Test creation restrictions */
for (w = 1; w <= 8; w++)
@@ -8614,7 +8611,6 @@ static void test_volume_blocks(void)
for (j = 0; j < sizeof(create_tests) / sizeof(*create_tests); j++)
{
BOOL may_succeed = FALSE;
- BOOL todo = FALSE;
if (create_tests[j].need_runtime_support && !formats[i].core_fmt && !support)
expect_hr = D3DERR_INVALIDCALL;
@@ -8623,10 +8619,7 @@ static void test_volume_blocks(void)
else if (pow2 && !size_is_pow2 && create_tests[j].need_driver_support)
expect_hr = D3DERR_INVALIDCALL;
else if (create_tests[j].need_driver_support && !support)
- {
- todo = support_2d;
expect_hr = D3DERR_INVALIDCALL;
- }
else
expect_hr = D3D_OK;
@@ -8642,18 +8635,9 @@ static void test_volume_blocks(void)
if (!formats[i].core_fmt && !support && FAILED(expect_hr))
may_succeed = TRUE;
- if (todo)
- {
- todo_wine ok(hr == expect_hr || ((SUCCEEDED(hr) && may_succeed)),
- "Got unexpected hr %#x for format %s, pool %s, size %ux%ux%u.\n",
- hr, formats[i].name, create_tests[j].name, w, h, d);
- }
- else
- {
- ok(hr == expect_hr || ((SUCCEEDED(hr) && may_succeed)),
- "Got unexpected hr %#x for format %s, pool %s, size %ux%ux%u.\n",
- hr, formats[i].name, create_tests[j].name, w, h, d);
- }
+ ok(hr == expect_hr || ((SUCCEEDED(hr) && may_succeed)),
+ "Got unexpected hr %#x for format %s, pool %s, size %ux%ux%u.\n",
+ hr, formats[i].name, create_tests[j].name, w, h, d);
if (FAILED(hr))
ok(texture == NULL, "Got texture ptr %p, expected NULL.\n", texture);
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 69491a9..1d2e71f 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -4491,25 +4491,6 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
case WINED3D_RTYPE_VOLUME_TEXTURE:
case WINED3D_RTYPE_VOLUME:
- /* The GL_EXT_texture_compression_s3tc spec requires that loading
- * an s3tc compressed texture results in an error. While the D3D
- * refrast does support s3tc volumes, at least the nvidia Windows
- * driver does not, so we're free not to support this format. */
- switch (check_format_id)
- {
- case WINED3DFMT_DXT1:
- case WINED3DFMT_DXT2:
- case WINED3DFMT_DXT3:
- case WINED3DFMT_DXT4:
- case WINED3DFMT_DXT5:
- TRACE("[FAILED] - DXTn does not support 3D textures.\n");
- return WINED3DERR_NOTAVAILABLE;
-
- default:
- /* Do nothing, continue with checking the format below */
- break;
- }
-
format_flags |= WINED3DFMT_FLAG_TEXTURE;
allowed_usage = WINED3DUSAGE_DYNAMIC
| WINED3DUSAGE_SOFTWAREPROCESSING
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 1d34440..b45e0bf 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -2293,6 +2293,22 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
|| !adapter->fragment_pipe->color_fixup_supported(format->color_fixup))
format_clear_flag(&gl_info->formats[idx], WINED3DFMT_FLAG_TEXTURE);
}
+
+ /* GL_EXT_texture_compression_s3tc does not support 3D textures. Some Windows drivers
+ * for dx9 GPUs support it, some do not, so not supporting DXTn volumes is OK for d3d9.
+ *
+ * Note that GL_NV_texture_compression_vtc adds this functionality to OpenGL, but the
+ * block layout is not compatible with the one used by d3d. See volume_dxt5_test. */
+ idx = getFmtIdx(WINED3DFMT_DXT1);
+ gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ idx = getFmtIdx(WINED3DFMT_DXT2);
+ gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ idx = getFmtIdx(WINED3DFMT_DXT3);
+ gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ idx = getFmtIdx(WINED3DFMT_DXT4);
+ gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ idx = getFmtIdx(WINED3DFMT_DXT5);
+ gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
}
static BOOL init_format_vertex_info(struct wined3d_gl_info *gl_info)
--
2.3.4
More information about the wine-patches
mailing list