[PATCH 1/5] d3dx9_36/tests: Create*TextureFromFileInMemory doesn't fail

Stefan Dösinger stefan at codeweavers.com
Tue Sep 3 07:07:13 CDT 2013


If the format is unsupported it picks a replacement format. Our d3dx9
cannot handle d3dx9 decompression yet, so mark the tests todo_wine in
this case.

Wine doesn't enforce volume texture format restrictions yet, that's why
I didn't add a todo_wine block for volumes yet. The next patch will add
those restrictions.
---
 dlls/d3dx9_36/tests/texture.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/dlls/d3dx9_36/tests/texture.c b/dlls/d3dx9_36/tests/texture.c
index fd072c8..f4e3a7f 100644
--- a/dlls/d3dx9_36/tests/texture.c
+++ b/dlls/d3dx9_36/tests/texture.c
@@ -25,7 +25,7 @@
 #include "d3dx9tex.h"
 #include "resources.h"
 
-static int has_dxt5;
+static int has_2d_dxt5, has_cube_dxt5;
 
 /* 2x2 16-bit dds, no mipmaps */
 static const unsigned char dds_16bit[] = {
@@ -1436,12 +1436,10 @@ static void test_D3DXCreateTextureFromFileInMemory(IDirect3DDevice9 *device)
 
     /* Check that D3DXCreateTextureFromFileInMemory accepts cube texture dds file (only first face texture is loaded) */
     hr = D3DXCreateTextureFromFileInMemory(device, dds_cube_map, sizeof(dds_cube_map), &texture);
-    if (!has_dxt5 && hr == E_NOTIMPL)
-    {
-        skip("DXT5 is not supported, skipping the D3DXCreateTextureFromFileInMemory() tests\n");
-        return;
-    }
-    ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
+    if (has_2d_dxt5)
+        ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
+    else
+        todo_wine ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
     if (SUCCEEDED(hr))
     {
         type = IDirect3DTexture9_GetType(texture);
@@ -1539,12 +1537,10 @@ static void test_D3DXCreateCubeTextureFromFileInMemoryEx(IDirect3DDevice9 *devic
 
     hr = D3DXCreateCubeTextureFromFileInMemoryEx(device, dds_cube_map, sizeof(dds_cube_map), D3DX_DEFAULT, D3DX_DEFAULT,
         D3DUSAGE_DYNAMIC | D3DUSAGE_AUTOGENMIPMAP, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &cube_texture);
-    if (!has_dxt5 && hr == E_NOTIMPL)
-    {
-        skip("DXT5 is not supported, skipping the D3DXCreateCubeTextureFromFileInMemoryEx() tests\n");
-        return;
-    }
-    ok(hr == D3D_OK, "D3DXCreateCubeTextureFromFileInMemoryEx returned %#x, expected %#x\n", hr, D3D_OK);
+    if (has_cube_dxt5)
+        ok(hr == D3D_OK, "D3DXCreateCubeTextureFromFileInMemoryEx returned %#x, expected %#x\n", hr, D3D_OK);
+    else
+        todo_wine ok(hr == D3D_OK, "D3DXCreateCubeTextureFromFileInMemoryEx returned %#x, expected %#x\n", hr, D3D_OK);
     if (SUCCEEDED(hr)) IDirect3DCubeTexture9_Release(cube_texture);
 }
 
@@ -1569,11 +1565,6 @@ static void test_D3DXCreateVolumeTextureFromFileInMemory(IDirect3DDevice9 *devic
     ok(hr == D3DERR_INVALIDCALL, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
 
     hr = D3DXCreateVolumeTextureFromFileInMemory(device, dds_volume_map, sizeof(dds_volume_map), &volume_texture);
-    if (!has_dxt5 && hr == E_NOTIMPL)
-    {
-        skip("DXT5 is not supported, skipping the D3DXCreateVolumeTextureFromFileInMemory() tests\n");
-        return;
-    }
     ok(hr == D3D_OK, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
     if (SUCCEEDED(hr))
     {
@@ -1821,7 +1812,10 @@ START_TEST(texture)
     /* Check whether DXT5 textures are supported */
     hr = IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
             D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT5);
-    has_dxt5 = SUCCEEDED(hr);
+    has_2d_dxt5 = SUCCEEDED(hr);
+    hr = IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+            D3DFMT_X8R8G8B8, 0, D3DRTYPE_CUBETEXTURE, D3DFMT_DXT5);
+    has_cube_dxt5 = SUCCEEDED(hr);
 
     test_D3DXCheckTextureRequirements(device);
     test_D3DXCheckCubeTextureRequirements(device);
-- 
1.8.1.5




More information about the wine-patches mailing list