[7/9] d3dx9/tests: Add tests for compressed pixel formats support in D3DXLoadSurface functions. (try 2)

Józef Kucia joseph.kucia at gmail.com
Sun May 13 16:00:09 CDT 2012


try2: Remove check_pixel_3bpp() macro as it's not relevant to DXTn tests.
---
 dlls/d3dx9_36/tests/surface.c |   66 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c
index 48b1c57..cb49ca3 100644
--- a/dlls/d3dx9_36/tests/surface.c
+++ b/dlls/d3dx9_36/tests/surface.c
@@ -839,6 +839,72 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
         check_release((IUnknown*)surf, 0);
     }
 
+    /* DXT1, DXT2, DXT3, DXT4, DXT5 */
+    hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 2, 2, D3DFMT_R8G8B8, D3DPOOL_SYSTEMMEM, &surf, NULL);
+    if (FAILED(hr))
+        skip("Failed to create R8G8B8 surface, hr %#x.\n", hr);
+    else
+    {
+        hr = D3DXLoadSurfaceFromFileInMemory(surf, NULL, NULL, dds_24bit, sizeof(dds_24bit), NULL, D3DX_FILTER_NONE, 0, NULL);
+        ok(SUCCEEDED(hr), "Failed to load surface, hr %#x.\n", hr);
+
+        hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 2, 2, D3DFMT_DXT2, D3DPOOL_SYSTEMMEM, &newsurf, NULL);
+        if (FAILED(hr))
+            skip("Failed to create DXT2 surface, hr %#x.\n", hr);
+        else
+        {
+            hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0);
+            todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels to DXT2 format.\n");
+            check_release((IUnknown*)newsurf, 0);
+        }
+
+        hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 2, 2, D3DFMT_DXT3, D3DPOOL_SYSTEMMEM, &newsurf, NULL);
+        if (FAILED(hr))
+            skip("Failed to create DXT3 surface, hr %#x.\n", hr);
+        else
+        {
+            hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0);
+            todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels to DXT3 format.\n");
+            check_release((IUnknown*)newsurf, 0);
+        }
+
+        hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 2, 2, D3DFMT_DXT4, D3DPOOL_SYSTEMMEM, &newsurf, NULL);
+        if (FAILED(hr))
+            skip("Failed to create DXT4 surface, hr %#x.\n", hr);
+        else
+        {
+            hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0);
+            todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels to DXT4 format.\n");
+            check_release((IUnknown*)newsurf, 0);
+        }
+
+        hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 2, 2, D3DFMT_DXT5, D3DPOOL_SYSTEMMEM, &newsurf, NULL);
+        if (FAILED(hr))
+            skip("Failed to create DXT5 surface, hr %#x.\n", hr);
+        else
+        {
+            hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0);
+            todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels to DXT5 format.\n");
+            check_release((IUnknown*)newsurf, 0);
+        }
+
+        hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 2, 2, D3DFMT_DXT1, D3DPOOL_SYSTEMMEM, &newsurf, NULL);
+        if (FAILED(hr))
+            skip("Failed to create DXT1 surface, hr %#x.\n", hr);
+        else
+        {
+            hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0);
+            todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels to DXT1 format.\n");
+
+            hr = D3DXLoadSurfaceFromSurface(surf, NULL, NULL, newsurf, NULL, NULL, D3DX_FILTER_NONE, 0);
+            todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels from DXT1 format.\n");
+
+            check_release((IUnknown*)newsurf, 0);
+        }
+
+        check_release((IUnknown*)surf, 0);
+    }
+
     /* cleanup */
     if(testdummy_ok) DeleteFileA("testdummy.bmp");
     if(testbitmap_ok) DeleteFileA("testbitmap.bmp");
-- 
1.7.8.6




More information about the wine-patches mailing list