[PATCH 1/2] wined3d: Check if formats are supported as render target in srgbwrite_format_test().

Henri Verbeet hverbeet at gmail.com
Tue Feb 1 13:47:21 CST 2011


Floating point formats in particular may not be supported everywhere.
---
 dlls/d3d9/tests/visual.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index c0cdf7e..e21ebf7 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -11446,14 +11446,17 @@ static void srgbwrite_format_test(IDirect3DDevice9 *device)
 
     for(i = 0; i < (sizeof(formats) / sizeof(*formats)); i++)
     {
-        hr = IDirect3DDevice9_CreateTexture(device, 8, 8, 1, D3DUSAGE_RENDERTARGET, formats[i].fmt,
-                                            D3DPOOL_DEFAULT, &texture, NULL);
-        ok(SUCCEEDED(hr), "CreateTexture failed, hr %#x.\n", hr);
-        if(FAILED(hr))
+        if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8,
+                D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, formats[i].fmt)))
         {
-            trace("Tex create failed\n");
+            skip("Format %s not supported as render target, skipping test.\n",
+                    formats[i].name);
             continue;
         }
+
+        hr = IDirect3DDevice9_CreateTexture(device, 8, 8, 1, D3DUSAGE_RENDERTARGET, formats[i].fmt,
+                                            D3DPOOL_DEFAULT, &texture, NULL);
+        ok(SUCCEEDED(hr), "CreateTexture failed, hr %#x.\n", hr);
         hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff0000, 0.0f, 0);
         ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr);
 
-- 
1.7.2.3




More information about the wine-patches mailing list