https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bbf66db254e2043b899e872d00378068a21fbc80

commit bbf66db254e2043b899e872d00378068a21fbc80
Author:     winesync <[email protected]>
AuthorDate: Mon Sep 21 23:00:50 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Thu Feb 4 16:37:04 2021 +0100

    [WINESYNC] d3dx9/tests: Improve tests to check for DXTn fallback formats.
    
    Signed-off-by: Matteo Bruni <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id d2f3fc03cb1dbcae77e199f3fd8eb2ccf419cfa5 by Matteo Bruni 
<[email protected]>
---
 modules/rostests/winetests/d3dx9_36/texture.c | 69 +++++++++++++++++++--------
 sdk/tools/winesync/d3dx9.cfg                  |  2 +-
 2 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/modules/rostests/winetests/d3dx9_36/texture.c 
b/modules/rostests/winetests/d3dx9_36/texture.c
index 04513fa4b07..fc1589d25e3 100644
--- a/modules/rostests/winetests/d3dx9_36/texture.c
+++ b/modules/rostests/winetests/d3dx9_36/texture.c
@@ -25,7 +25,7 @@
 #include "d3dx9tex.h"
 #include "resources.h"
 
-static int has_2d_dxt3, has_2d_dxt5, has_cube_dxt5, has_3d_dxt3;
+static int has_2d_dxt1, has_2d_dxt3, has_2d_dxt5, has_cube_dxt5, has_3d_dxt3;
 
 /* 2x2 16-bit dds, no mipmaps */
 static const unsigned char dds_16bit[] = {
@@ -419,30 +419,57 @@ static void 
test_D3DXCheckTextureRequirements(IDirect3DDevice9 *device)
     ok(format == expected, "Returned format %u, expected %u\n", format, 
expected);
 
     /* Block-based texture formats and size < block size. */
-    if (has_2d_dxt5)
+    format = D3DFMT_DXT1;
+    width = 2; height = 2;
+    mipmaps = 1;
+    hr = D3DXCheckTextureRequirements(device, &width, &height, &mipmaps, 0, 
&format, D3DPOOL_DEFAULT);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    ok(mipmaps == 1, "Got unexpected level count %u.\n", mipmaps);
+    if (has_2d_dxt1)
     {
-        format = D3DFMT_DXT5;
-        width = 2; height = 2;
-        mipmaps = 1;
-        hr = D3DXCheckTextureRequirements(device, &width, &height, &mipmaps, 
0, &format, D3DPOOL_DEFAULT);
-        ok(hr == D3D_OK, "D3DXCheckTextureRequirements returned %#x, expected 
%#x\n", hr, D3D_OK);
-        ok(width == 4, "Returned width %d, expected %d\n", width, 4);
-        ok(height == 4, "Returned height %d, expected %d\n", height, 4);
-        ok(mipmaps == 1, "Returned mipmaps %d, expected %d\n", mipmaps, 1);
-        ok(format == D3DFMT_DXT5, "Returned format %u, expected %u\n", format, 
D3DFMT_DXT5);
+        ok(width == 4, "Got unexpected width %d.\n", width);
+        ok(height == 4, "Got unexpected height %d.\n", height);
+        ok(format == D3DFMT_DXT1, "Got unexpected format %u.\n", format);
+    }
+    else
+    {
+        ok(width == 2, "Got unexpected width %d.\n", width);
+        ok(height == 2, "Got unexpected height %d.\n", height);
+        ok(format == D3DFMT_A8R8G8B8, "Got unexpected format %u.\n", format);
+    }
 
-        width = 4;
-        height = 2;
-        hr = D3DXCheckTextureRequirements(device, &width, &height, &mipmaps, 
0, &format, D3DPOOL_DEFAULT);
-        ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
-        ok(width == 4, "Got unexpected width %u.\n", width);
+    format = D3DFMT_DXT5;
+    width = 2; height = 2;
+    hr = D3DXCheckTextureRequirements(device, &width, &height, &mipmaps, 0, 
&format, D3DPOOL_DEFAULT);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    ok(mipmaps == 1, "Got unexpected level count %u.\n", mipmaps);
+    if (has_2d_dxt5)
+    {
+        ok(width == 4, "Got unexpected width %d.\n", width);
+        ok(height == 4, "Got unexpected height %d.\n", height);
+        ok(format == D3DFMT_DXT5, "Got unexpected format %u.\n", format);
+    }
+    else
+    {
+        ok(width == 2, "Got unexpected width %d.\n", width);
+        ok(height == 2, "Got unexpected height %d.\n", height);
+        ok(format == D3DFMT_A8R8G8B8, "Got unexpected format %u.\n", format);
+    }
+    width = 4;
+    height = 2;
+    hr = D3DXCheckTextureRequirements(device, &width, &height, &mipmaps, 0, 
&format, D3DPOOL_DEFAULT);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    ok(width == 4, "Got unexpected width %u.\n", width);
+    ok(mipmaps == 1, "Got unexpected level count %u.\n", mipmaps);
+    if (has_2d_dxt5)
+    {
         ok(height == 4, "Got unexpected height %u.\n", height);
-        ok(mipmaps == 1, "Got unexpected mipmap level count %u.\n", mipmaps);
         ok(format == D3DFMT_DXT5, "Got unexpected format %u.\n", format);
     }
     else
     {
-        skip("D3DFMT_DXT5 textures are not supported, skipping a test.\n");
+        ok(height == 2, "Got unexpected height %u.\n", height);
+        ok(format == D3DFMT_A8R8G8B8, "Got unexpected format %u.\n", format);
     }
 
     IDirect3D9_Release(d3d);
@@ -2511,6 +2538,8 @@ START_TEST(texture)
     }
 
     /* Check whether DXTn textures are supported. */
+    has_2d_dxt1 = SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d, 
D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+            D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1));
     has_2d_dxt3 = SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d, 
D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
             D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT3));
     has_2d_dxt5 = SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d, 
D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
@@ -2519,8 +2548,8 @@ START_TEST(texture)
             D3DFMT_X8R8G8B8, 0, D3DRTYPE_CUBETEXTURE, D3DFMT_DXT5));
     has_3d_dxt3 = SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d, 
D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
             D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, D3DFMT_DXT3));
-    trace("DXTn texture support: 2D DXT3 %#x, 2D DXT5 %#x, cube DXT5 %#x, 3D 
dxt3 %#x.\n",
-            has_2d_dxt3, has_2d_dxt5, has_cube_dxt5, has_3d_dxt3);
+    trace("DXTn texture support: 2D DXT1 %#x, 2D DXT3 %#x, 2D DXT5 %#x, cube 
DXT5 %#x, 3D dxt3 %#x.\n",
+            has_2d_dxt1, has_2d_dxt3, has_2d_dxt5, has_cube_dxt5, has_3d_dxt3);
 
     test_D3DXCheckTextureRequirements(device);
     test_D3DXCheckCubeTextureRequirements(device);
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index cad5dac2594..a6dc16d1d1e 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, 
include/d3dx9anim.h: sdk/inc
   include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: 
sdk/include/dxsdk/d3dx9of.h,
   include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, 
include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
   include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: 
sdk/include/dxsdk/d3dx9xof.h}
-tags: {wine: 376182062ff1ab8e7835fd67bc650da83c2cc75d}
+tags: {wine: d2f3fc03cb1dbcae77e199f3fd8eb2ccf419cfa5}

Reply via email to