d3d8/tests: DXGetErrorString8() is very imprecise so add a wrapper function that also prints the exact error value.

Francois Gouget fgouget at codeweavers.com
Tue Jun 12 10:45:31 CDT 2007


---

We could also modify the trace()/ok() calls to print both the raw error 
code and the output of DXGetErrorString8() but that seemed like a more 
invasive change. But I can do it if that would be better.


 dlls/d3d8/tests/device.c |  136 +++++++++++++++++++++++-----------------------
 dlls/d3d8/tests/visual.c |  115 ++++++++++++++++++++++-----------------
 2 files changed, 133 insertions(+), 118 deletions(-)

diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 84b5f29..af70992 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -22,6 +22,8 @@
 #include <dxerr8.h>
 #include "wine/test.h"
 
+extern const char* dx_error_string(HRESULT);
+
 static IDirect3D8 *(WINAPI *pDirect3DCreate8)(UINT);
 
 static const DWORD simple_vs[] = {0xFFFE0101,       /* vs_1_1               */
@@ -50,7 +52,7 @@ static int get_refcount(IUnknown *object)
         int rc_new = rc; \
         ok(tmp1 == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, tmp1); \
     } else {\
-        trace("%s failed: %s\n", c, DXGetErrorString8(r)); \
+        trace("%s failed: %s\n", c, dx_error_string(r)); \
     }
 
 #define CHECK_RELEASE(obj,d,rc) \
@@ -104,7 +106,7 @@ static void check_mipmap_levels(
         DWORD levels = IDirect3DBaseTexture8_GetLevelCount(texture);
         ok(levels == count, "Invalid level count. Expected %d got %u\n", count, levels);
     } else 
-        trace("CreateTexture failed: %s\n", DXGetErrorString8(hr));
+        trace("CreateTexture failed: %s\n", dx_error_string(hr));
 
     if (texture) IUnknown_Release( texture );
 }
@@ -191,39 +193,39 @@ static void test_swapchain(void)
     /* Create a bunch of swapchains */
     d3dpp.BackBufferCount = 0;
     hr = IDirect3DDevice8_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain1);
-    ok(SUCCEEDED(hr), "Failed to create a swapchain (%s)\n", DXGetErrorString8(hr));
+    ok(SUCCEEDED(hr), "Failed to create a swapchain (%s)\n", dx_error_string(hr));
     ok(d3dpp.BackBufferCount == 1, "The back buffer count in the presentparams struct is %d\n", d3dpp.BackBufferCount);
 
     d3dpp.BackBufferCount  = 1;
     hr = IDirect3DDevice8_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain2);
-    ok(SUCCEEDED(hr), "Failed to create a swapchain (%s)\n", DXGetErrorString8(hr));
+    ok(SUCCEEDED(hr), "Failed to create a swapchain (%s)\n", dx_error_string(hr));
 
     d3dpp.BackBufferCount  = 2;
     hr = IDirect3DDevice8_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain3);
-    ok(SUCCEEDED(hr), "Failed to create a swapchain (%s)\n", DXGetErrorString8(hr));
+    ok(SUCCEEDED(hr), "Failed to create a swapchain (%s)\n", dx_error_string(hr));
     if(SUCCEEDED(hr)) {
         /* Swapchain 3, created with backbuffercount 2 */
         backbuffer = (void *) 0xdeadbeef;
         hr = IDirect3DSwapChain8_GetBackBuffer(swapchain3, 0, 0, &backbuffer);
-        ok(SUCCEEDED(hr), "Failed to get the 1st back buffer (%s)\n", DXGetErrorString8(hr));
+        ok(SUCCEEDED(hr), "Failed to get the 1st back buffer (%s)\n", dx_error_string(hr));
         ok(backbuffer != NULL && backbuffer != (void *) 0xdeadbeef, "The back buffer is %p\n", backbuffer);
         if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
 
         backbuffer = (void *) 0xdeadbeef;
         hr = IDirect3DSwapChain8_GetBackBuffer(swapchain3, 1, 0, &backbuffer);
-        ok(SUCCEEDED(hr), "Failed to get the 2nd back buffer (%s)\n", DXGetErrorString8(hr));
+        ok(SUCCEEDED(hr), "Failed to get the 2nd back buffer (%s)\n", dx_error_string(hr));
         ok(backbuffer != NULL && backbuffer != (void *) 0xdeadbeef, "The back buffer is %p\n", backbuffer);
         if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
 
         backbuffer = (void *) 0xdeadbeef;
         hr = IDirect3DSwapChain8_GetBackBuffer(swapchain3, 2, 0, &backbuffer);
-        ok(hr == D3DERR_INVALIDCALL, "GetBackBuffer returned %s\n", DXGetErrorString8(hr));
+        ok(hr == D3DERR_INVALIDCALL, "GetBackBuffer returned %s\n", dx_error_string(hr));
         ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
         if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
 
         backbuffer = (void *) 0xdeadbeef;
         hr = IDirect3DSwapChain8_GetBackBuffer(swapchain3, 3, 0, &backbuffer);
-        ok(FAILED(hr), "Failed to get the back buffer (%s)\n", DXGetErrorString8(hr));
+        ok(FAILED(hr), "Failed to get the back buffer (%s)\n", dx_error_string(hr));
         ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
         if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
     }
@@ -231,32 +233,32 @@ static void test_swapchain(void)
     /* Check the back buffers of the swapchains */
     /* Swapchain 1, created with backbuffercount 0 */
     hr = IDirect3DSwapChain8_GetBackBuffer(swapchain1, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);
-    ok(SUCCEEDED(hr), "Failed to get the back buffer (%s)\n", DXGetErrorString8(hr));
-    ok(backbuffer != NULL, "The back buffer is NULL (%s)\n", DXGetErrorString8(hr));
+    ok(SUCCEEDED(hr), "Failed to get the back buffer (%s)\n", dx_error_string(hr));
+    ok(backbuffer != NULL, "The back buffer is NULL (%s)\n", dx_error_string(hr));
     if(backbuffer) IDirect3DSurface8_Release(backbuffer);
 
     backbuffer = (void *) 0xdeadbeef;
     hr = IDirect3DSwapChain8_GetBackBuffer(swapchain1, 1, 0, &backbuffer);
-    ok(FAILED(hr), "Failed to get the back buffer (%s)\n", DXGetErrorString8(hr));
+    ok(FAILED(hr), "Failed to get the back buffer (%s)\n", dx_error_string(hr));
     ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
     if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
 
     /* Swapchain 2 - created with backbuffercount 1 */
     backbuffer = (void *) 0xdeadbeef;
     hr = IDirect3DSwapChain8_GetBackBuffer(swapchain2, 0, 0, &backbuffer);
-    ok(SUCCEEDED(hr), "Failed to get the back buffer (%s)\n", DXGetErrorString8(hr));
+    ok(SUCCEEDED(hr), "Failed to get the back buffer (%s)\n", dx_error_string(hr));
     ok(backbuffer != NULL && backbuffer != (void *) 0xdeadbeef, "The back buffer is %p\n", backbuffer);
     if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
 
     backbuffer = (void *) 0xdeadbeef;
     hr = IDirect3DSwapChain8_GetBackBuffer(swapchain2, 1, 0, &backbuffer);
-    ok(hr == D3DERR_INVALIDCALL, "GetBackBuffer returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3DERR_INVALIDCALL, "GetBackBuffer returned %s\n", dx_error_string(hr));
     ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
     if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
 
     backbuffer = (void *) 0xdeadbeef;
     hr = IDirect3DSwapChain8_GetBackBuffer(swapchain2, 2, 0, &backbuffer);
-    ok(FAILED(hr), "Failed to get the back buffer (%s)\n", DXGetErrorString8(hr));
+    ok(FAILED(hr), "Failed to get the back buffer (%s)\n", dx_error_string(hr));
     ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
     if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
 
@@ -702,9 +704,9 @@ static void test_states(void)
     }
 
     hr = IDirect3DDevice8_SetRenderState(pDevice, D3DRS_ZVISIBLE, TRUE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState(D3DRS_ZVISIBLE, TRUE) returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState(D3DRS_ZVISIBLE, TRUE) returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(pDevice, D3DRS_ZVISIBLE, FALSE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState(D3DRS_ZVISIBLE, FALSE) returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState(D3DRS_ZVISIBLE, FALSE) returned %s\n", dx_error_string(hr));
 
 cleanup:
     if(pD3d) IDirect3D8_Release(pD3d);
@@ -721,7 +723,7 @@ static void test_shader_versions(void)
     ok(pD3d != NULL, "Failed to create IDirect3D8 object\n");
     if (pD3d != NULL) {
         hr = IDirect3D8_GetDeviceCaps(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dcaps);
-        ok(SUCCEEDED(hr), "Failed to get D3D8 caps (%s)\n", DXGetErrorString8(hr));
+        ok(SUCCEEDED(hr), "Failed to get D3D8 caps (%s)\n", dx_error_string(hr));
         if (SUCCEEDED(hr)) {
             ok(d3dcaps.VertexShaderVersion <= D3DVS_VERSION(1,1), "Unexpected VertexShaderVersion (%#x > %#x)\n", d3dcaps.VertexShaderVersion, D3DVS_VERSION(1,1));
             ok(d3dcaps.PixelShaderVersion <= D3DPS_VERSION(1,4), "Unexpected PixelShaderVersion (%#x > %#x)\n", d3dcaps.PixelShaderVersion, D3DPS_VERSION(1,4));
@@ -748,7 +750,7 @@ static void test_display_modes(void)
 
     for(i=0; i<max_modes;i++) {
         res = IDirect3D8_EnumAdapterModes(pD3d, D3DADAPTER_DEFAULT, i, &dmode);
-        ok(res==D3D_OK, "EnumAdapterModes returned %s for mode %u!\n", DXGetErrorString8(res), i);
+        ok(res==D3D_OK, "EnumAdapterModes returned %s for mode %u!\n", dx_error_string(res), i);
         if(res != D3D_OK)
             continue;
 
@@ -785,35 +787,35 @@ static void test_scene(void)
 
     hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd,
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
-    ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", dx_error_string(hr));
     if(!pDevice) goto cleanup;
 
     /* Test an EndScene without beginscene. Should return an error */
     hr = IDirect3DDevice8_EndScene(pDevice);
-    ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %s\n", dx_error_string(hr));
 
     /* Test a normal BeginScene / EndScene pair, this should work */
     hr = IDirect3DDevice8_BeginScene(pDevice);
-    ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %s\n", dx_error_string(hr));
     if(SUCCEEDED(hr))
     {
         hr = IDirect3DDevice8_EndScene(pDevice);
-        ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %s\n", dx_error_string(hr));
     }
 
     /* Test another EndScene without having begun a new scene. Should return an error */
     hr = IDirect3DDevice8_EndScene(pDevice);
-    ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %s\n", dx_error_string(hr));
 
     /* Two nested BeginScene and EndScene calls */
     hr = IDirect3DDevice8_BeginScene(pDevice);
-    ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_BeginScene(pDevice);
-    ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_BeginScene returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_BeginScene returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_EndScene(pDevice);
-    ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_EndScene(pDevice);
-    ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %s\n", dx_error_string(hr));
 
     /* StretchRect does not exit in Direct3D8, so no equivalent to the d3d9 stretchrect tests */
 
@@ -864,130 +866,130 @@ static void test_shader(void)
 
     hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd,
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
-    ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", dx_error_string(hr));
     if(!pDevice) goto cleanup;
 
     /* First create a vertex shader */
     hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, simple_vs, &hVertexShader, 0);
-    ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %s\n", dx_error_string(hr));
     /* Msdn says that the new vertex shader is set immediately. This is wrong, apparently */
     hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", dx_error_string(hr));
     ok(hTempHandle == 0, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, 0);
     /* Assign the shader, then verify that GetVertexShader works */
     hr = IDirect3DDevice8_SetVertexShader(pDevice, hVertexShader);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", dx_error_string(hr));
     ok(hTempHandle == hVertexShader, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, hVertexShader);
     /* Verify that we can retrieve the declaration */
     hr = IDirect3DDevice8_GetVertexShaderDeclaration(pDevice, hVertexShader, NULL, &data_size);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShaderDeclaration returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShaderDeclaration returned %s\n", dx_error_string(hr));
     ok(data_size == vertex_decl_size, "Got data_size %u, expected %u\n", data_size, vertex_decl_size);
     data = HeapAlloc(GetProcessHeap(), 0, vertex_decl_size);
     data_size = 1;
     hr = IDirect3DDevice8_GetVertexShaderDeclaration(pDevice, hVertexShader, data, &data_size);
     ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetVertexShaderDeclaration returned %s (0x%#x), "
-            "expected D3DERR_INVALIDCALL\n", DXGetErrorString8(hr), hr);
+            "expected D3DERR_INVALIDCALL\n", dx_error_string(hr), hr);
     ok(data_size == 1, "Got data_size %u, expected 1\n", data_size);
     data_size = vertex_decl_size;
     hr = IDirect3DDevice8_GetVertexShaderDeclaration(pDevice, hVertexShader, data, &data_size);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShaderDeclaration returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShaderDeclaration returned %s\n", dx_error_string(hr));
     ok(data_size == vertex_decl_size, "Got data_size %u, expected %u\n", data_size, vertex_decl_size);
     ok(!memcmp(data, dwVertexDecl, vertex_decl_size), "data not equal to shader declaration\n");
     HeapFree(GetProcessHeap(), 0, data);
     /* Verify that we can retrieve the shader function */
     hr = IDirect3DDevice8_GetVertexShaderFunction(pDevice, hVertexShader, NULL, &data_size);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShaderFucntion returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShaderFucntion returned %s\n", dx_error_string(hr));
     ok(data_size == simple_vs_size, "Got data_size %u, expected %u\n", data_size, simple_vs_size);
     data = HeapAlloc(GetProcessHeap(), 0, simple_vs_size);
     data_size = 1;
     hr = IDirect3DDevice8_GetVertexShaderFunction(pDevice, hVertexShader, data, &data_size);
     ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetVertexShaderFunction returned %s (0x%#x), "
-            "expected D3DERR_INVALIDCALL\n", DXGetErrorString8(hr), hr);
+            "expected D3DERR_INVALIDCALL\n", dx_error_string(hr), hr);
     ok(data_size == 1, "Got data_size %u, expected 1\n", data_size);
     data_size = simple_vs_size;
     hr = IDirect3DDevice8_GetVertexShaderFunction(pDevice, hVertexShader, data, &data_size);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShaderFunction returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShaderFunction returned %s\n", dx_error_string(hr));
     ok(data_size == simple_vs_size, "Got data_size %u, expected %u\n", data_size, simple_vs_size);
     ok(!memcmp(data, simple_vs, simple_vs_size), "data not equal to shader function\n");
     HeapFree(GetProcessHeap(), 0, data);
     /* Delete the assigned shader. This is supposed to work */
     hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader);
-    ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", dx_error_string(hr));
     /* The shader should be unset now */
     hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", dx_error_string(hr));
     ok(hTempHandle == 0, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, 0);
 
     /* The same with a pixel shader */
     hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader);
-    ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", dx_error_string(hr));
     /* Msdn says that the new pixel shader is set immediately. This is wrong, apparently */
     hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", dx_error_string(hr));
     ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0);
     /* Assign the shader, then verify that GetPixelShader works */
     hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", dx_error_string(hr));
     ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader);
     /* Verify that we can retrieve the shader function */
     hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, NULL, &data_size);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFucntion returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFucntion returned %s\n", dx_error_string(hr));
     ok(data_size == simple_ps_size, "Got data_size %u, expected %u\n", data_size, simple_ps_size);
     data = HeapAlloc(GetProcessHeap(), 0, simple_ps_size);
     data_size = 1;
     hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_size);
     ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetPixelShaderFunction returned %s (0x%#x), "
-            "expected D3DERR_INVALIDCALL\n", DXGetErrorString8(hr), hr);
+            "expected D3DERR_INVALIDCALL\n", dx_error_string(hr), hr);
     ok(data_size == 1, "Got data_size %u, expected 1\n", data_size);
     data_size = simple_ps_size;
     hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_size);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFunction returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFunction returned %s\n", dx_error_string(hr));
     ok(data_size == simple_ps_size, "Got data_size %u, expected %u\n", data_size, simple_ps_size);
     ok(!memcmp(data, simple_ps, simple_ps_size), "data not equal to shader function\n");
     HeapFree(GetProcessHeap(), 0, data);
     /* Delete the assigned shader. This is supposed to work */
     hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader);
-    ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", dx_error_string(hr));
     /* The shader should be unset now */
     hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", dx_error_string(hr));
     ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0);
 
     /* What happens if a non-bound shader is deleted? */
     hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader, 0);
-    ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader2, 0);
-    ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %s\n", dx_error_string(hr));
 
     hr = IDirect3DDevice8_SetVertexShader(pDevice, hVertexShader);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader2);
-    ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", dx_error_string(hr));
     ok(hTempHandle == hVertexShader, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, hVertexShader);
     hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader);
-    ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", dx_error_string(hr));
 
     /* Now for pixel shaders */
     hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader);
-    ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader2);
-    ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", dx_error_string(hr));
 
     hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader2);
-    ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
-    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", dx_error_string(hr));
     ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader);
     hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader);
-    ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", dx_error_string(hr));
 
 cleanup:
     if(pD3d) IDirect3D8_Release(pD3d);
@@ -1024,21 +1026,21 @@ static void test_limits(void)
 
     hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd,
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
-    ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", dx_error_string(hr));
     if(!pDevice) goto cleanup;
 
     hr = IDirect3DDevice8_CreateTexture(pDevice, 16, 16, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &pTexture);
-    ok(hr == D3D_OK, "IDirect3DDevice8_CreateTexture failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_CreateTexture failed with %s\n", dx_error_string(hr));
     if(!pTexture) goto cleanup;
 
     /* There are 8 texture stages. We should be able to access all of them */
     for(i = 0; i < 8; i++) {
         hr = IDirect3DDevice8_SetTexture(pDevice, i, (IDirect3DBaseTexture8 *) pTexture);
-        ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %s\n", i, DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %s\n", i, dx_error_string(hr));
         hr = IDirect3DDevice8_SetTexture(pDevice, i, NULL);
-        ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %s\n", i, DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %s\n", i, dx_error_string(hr));
         hr = IDirect3DDevice8_SetTextureStageState(pDevice, i, D3DTSS_COLOROP, D3DTOP_ADD);
-        ok(hr == D3D_OK, "IDirect3DDevice8_SetTextureStageState for texture %d failed with %s\n", i, DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_SetTextureStageState for texture %d failed with %s\n", i, dx_error_string(hr));
     }
 
     /* Investigations show that accessing higher textures stage states does not return an error either. Writing
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index f755679..994ddcb 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -19,11 +19,24 @@
 
 /* See comment in dlls/d3d9/tests/visual.c for general guidelines */
 
+#include <stdio.h>
+
 #define COBJMACROS
 #include <d3d8.h>
 #include <dxerr8.h>
 #include "wine/test.h"
 
+static char* error_string=NULL;
+const char* dx_error_string(HRESULT hr)
+{
+    const char* str=DXGetErrorString8(hr);
+    HeapFree(GetProcessHeap(), 0, error_string);
+    error_string=HeapAlloc(GetProcessHeap(), 0, strlen(str)+11+1);
+    sprintf(error_string, "%s (%08x)", str, hr);
+    return error_string;
+}
+
+
 static HMODULE d3d8_handle = 0;
 
 static HWND create_window(void)
@@ -51,13 +64,13 @@ static DWORD getPixelColor(IDirect3DDevice8 *device, UINT x, UINT y)
     hr = IDirect3DDevice8_CreateTexture(device, 640, 480, 1 /* Levels */, 0 /* usage */, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &tex);
     if(FAILED(hr) || !tex )  /* This is not a test */
     {
-        trace("Can't create an offscreen plain surface to read the render target data, hr=%s\n", DXGetErrorString8(hr));
+        trace("Can't create an offscreen plain surface to read the render target data, hr=%s\n", dx_error_string(hr));
         return 0xdeadbeef;
     }
     hr = IDirect3DTexture8_GetSurfaceLevel(tex, 0, &surf);
     if(FAILED(hr) || !tex )  /* This is not a test */
     {
-        trace("Can't get surface from texture, hr=%s\n", DXGetErrorString8(hr));
+        trace("Can't get surface from texture, hr=%s\n", dx_error_string(hr));
         ret = 0xdeadbeee;
         goto out;
     }
@@ -65,7 +78,7 @@ static DWORD getPixelColor(IDirect3DDevice8 *device, UINT x, UINT y)
     hr = IDirect3DDevice8_GetFrontBuffer(device, surf);
     if(FAILED(hr))
     {
-        trace("Can't read the front buffer data, hr=%s\n", DXGetErrorString8(hr));
+        trace("Can't read the front buffer data, hr=%s\n", dx_error_string(hr));
         ret = 0xdeadbeed;
         goto out;
     }
@@ -73,7 +86,7 @@ static DWORD getPixelColor(IDirect3DDevice8 *device, UINT x, UINT y)
     hr = IDirect3DSurface8_LockRect(surf, &lockedRect, &rectToLock, D3DLOCK_READONLY);
     if(FAILED(hr))
     {
-        trace("Can't lock the offscreen surface, hr=%s\n", DXGetErrorString8(hr));
+        trace("Can't lock the offscreen surface, hr=%s\n", dx_error_string(hr));
         ret = 0xdeadbeec;
         goto out;
     }
@@ -84,7 +97,7 @@ static DWORD getPixelColor(IDirect3DDevice8 *device, UINT x, UINT y)
     hr = IDirect3DSurface8_UnlockRect(surf);
     if(FAILED(hr))
     {
-        trace("Can't unlock the offscreen surface, hr=%s\n", DXGetErrorString8(hr));
+        trace("Can't unlock the offscreen surface, hr=%s\n", dx_error_string(hr));
     }
 
 out:
@@ -118,7 +131,7 @@ static IDirect3DDevice8 *init_d3d8(void)
     present_parameters.BackBufferFormat = D3DFMT_X8R8G8B8;
 
     hr = IDirect3D8_CreateDevice(d3d8_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device_ptr);
-    ok(hr == D3D_OK, "IDirect3D_CreateDevice returned: %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3D_CreateDevice returned: %s\n", dx_error_string(hr));
 
     return device_ptr;
 }
@@ -179,69 +192,69 @@ static void lighting_test(IDirect3DDevice8 *device)
     WORD Indices[] = {0, 1, 2, 2, 3, 0};
 
     hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 0);
-    ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %s\n", dx_error_string(hr));
 
     /* Setup some states that may cause issues */
     hr = IDirect3DDevice8_SetTransform(device, D3DTS_WORLDMATRIX(0), (D3DMATRIX *) mat);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetTransform returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetTransform returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetTransform(device, D3DTS_VIEW, (D3DMATRIX *)mat);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetTransform returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetTransform returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, (D3DMATRIX *) mat);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetTransform returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetTransform returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_CLIPPING, FALSE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, FALSE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, FALSE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_STENCILENABLE, FALSE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ALPHATESTENABLE, FALSE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ALPHABLENDENABLE, FALSE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_NONE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState failed with %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState failed with %s\n", dx_error_string(hr));
 
     hr = IDirect3DDevice8_SetVertexShader(device, fvf);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", dx_error_string(hr));
 
     hr = IDirect3DDevice8_BeginScene(device);
-    ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %s\n", dx_error_string(hr));
     if(hr == D3D_OK)
     {
         /* No lights are defined... That means, lit vertices should be entirely black */
         hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE);
-        ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
         hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
                                                     2 /*PrimCount */, Indices, D3DFMT_INDEX16, unlitquad, sizeof(unlitquad[0]));
-        ok(hr == D3D_OK, "IDirect3DDevice8_DrawIndexedPrimitiveUP failed with %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_DrawIndexedPrimitiveUP failed with %s\n", dx_error_string(hr));
 
         hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, TRUE);
-        ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
         hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
                                                     2 /*PrimCount */, Indices, D3DFMT_INDEX16, litquad, sizeof(litquad[0]));
-        ok(hr == D3D_OK, "IDirect3DDevice8_DrawIndexedPrimitiveUP failed with %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_DrawIndexedPrimitiveUP failed with %s\n", dx_error_string(hr));
 
         hr = IDirect3DDevice8_SetVertexShader(device, nfvf);
-        ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader failed with %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader failed with %s\n", dx_error_string(hr));
 
         hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE);
-        ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
         hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
                                                     2 /*PrimCount */, Indices, D3DFMT_INDEX16, unlitnquad, sizeof(unlitnquad[0]));
-        ok(hr == D3D_OK, "IDirect3DDevice8_DrawIndexedPrimitiveUP failed with %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_DrawIndexedPrimitiveUP failed with %s\n", dx_error_string(hr));
 
         hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, TRUE);
-        ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
         hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
                                                     2 /*PrimCount */, Indices, D3DFMT_INDEX16, litnquad, sizeof(litnquad[0]));
-        ok(hr == D3D_OK, "IDirect3DDevice8_DrawIndexedPrimitiveUP failed with %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_DrawIndexedPrimitiveUP failed with %s\n", dx_error_string(hr));
 
         IDirect3DDevice8_EndScene(device);
-        ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %s\n", dx_error_string(hr));
     }
 
     IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
@@ -256,7 +269,7 @@ static void lighting_test(IDirect3DDevice8 *device)
     ok(color == 0x00000000, "Lit quad width normals has color %08x\n", color);
 
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE);
-    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", dx_error_string(hr));
 }
 
 static void clear_test(IDirect3DDevice8 *device)
@@ -268,7 +281,7 @@ static void clear_test(IDirect3DDevice8 *device)
     DWORD color;
 
     hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 0);
-    ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %s\n", dx_error_string(hr));
 
     /* Positive x, negative y */
     rect[0].x1 = 0;
@@ -285,7 +298,7 @@ static void clear_test(IDirect3DDevice8 *device)
      * is ignored, the positive is still cleared afterwards
      */
     hr = IDirect3DDevice8_Clear(device, 2, rect, D3DCLEAR_TARGET, 0xffff0000, 0.0, 0);
-    ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %s\n", dx_error_string(hr));
 
     /* negative x, negative y */
     rect_negneg.x1 = 640;
@@ -293,7 +306,7 @@ static void clear_test(IDirect3DDevice8 *device)
     rect_negneg.x2 = 320;
     rect_negneg.y2 = 0;
     hr = IDirect3DDevice8_Clear(device, 1, &rect_negneg, D3DCLEAR_TARGET, 0xff00ff00, 0.0, 0);
-    ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %s\n", dx_error_string(hr));
 
     IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
 
@@ -357,60 +370,60 @@ static void fog_test(IDirect3DDevice8 *device)
     WORD Indices[] = {0, 1, 2, 2, 3, 0};
 
     hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff00ff, 0.0, 0);
-    ok(hr == D3D_OK, "IDirect3DDevice8_Clear returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "IDirect3DDevice8_Clear returned %s\n", dx_error_string(hr));
 
     /* Setup initial states: No lighting, fog on, fog color */
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE);
-    ok(hr == D3D_OK, "Turning off lighting returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "Turning off lighting returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE);
-    ok(hr == D3D_OK, "Turning on fog calculations returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "Turning on fog calculations returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0xFF00FF00 /* A nice green */);
-    ok(hr == D3D_OK, "Turning on fog calculations returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "Turning on fog calculations returned %s\n", dx_error_string(hr));
 
     /* First test: Both table fog and vertex fog off */
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, D3DFOG_NONE);
-    ok(hr == D3D_OK, "Turning off table fog returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "Turning off table fog returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_NONE);
-    ok(hr == D3D_OK, "Turning off table fog returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "Turning off table fog returned %s\n", dx_error_string(hr));
 
     /* Start = 0, end = 1. Should be default, but set them */
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, *((DWORD *) &start));
-    ok(hr == D3D_OK, "Setting fog start returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "Setting fog start returned %s\n", dx_error_string(hr));
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, *((DWORD *) &end));
-    ok(hr == D3D_OK, "Setting fog start returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "Setting fog start returned %s\n", dx_error_string(hr));
 
     if(IDirect3DDevice8_BeginScene(device) == D3D_OK)
     {
         hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR);
-        ok( hr == D3D_OK, "SetVertexShader returned %s\n", DXGetErrorString8(hr));
+        ok( hr == D3D_OK, "SetVertexShader returned %s\n", dx_error_string(hr));
         /* Untransformed, vertex fog = NONE, table fog = NONE: Read the fog weighting from the specular color */
         hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
                                                      2 /*PrimCount */, Indices, D3DFMT_INDEX16, unstransformed_1,
                                                      sizeof(unstransformed_1[0]));
-        ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %s\n", dx_error_string(hr));
 
         /* That makes it use the Z value */
         hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR);
-        ok(hr == D3D_OK, "Turning off table fog returned %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "Turning off table fog returned %s\n", dx_error_string(hr));
         /* Untransformed, vertex fog != none (or table fog != none):
          * Use the Z value as input into the equation
          */
         hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
                                                      2 /*PrimCount */, Indices, D3DFMT_INDEX16, unstransformed_2,
                                                      sizeof(unstransformed_1[0]));
-        ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %s\n", dx_error_string(hr));
 
         /* transformed verts */
         hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR);
-        ok( hr == D3D_OK, "SetVertexShader returned %s\n", DXGetErrorString8(hr));
+        ok( hr == D3D_OK, "SetVertexShader returned %s\n", dx_error_string(hr));
         /* Transformed, vertex fog != NONE, pixel fog == NONE: Use specular color alpha component */
         hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
                                                      2 /*PrimCount */, Indices, D3DFMT_INDEX16, transformed_1,
                                                      sizeof(transformed_1[0]));
-        ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %s\n", dx_error_string(hr));
 
         hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, D3DFOG_LINEAR);
-        ok( hr == D3D_OK, "Setting fog table mode to D3DFOG_LINEAR returned %s\n", DXGetErrorString8(hr));
+        ok( hr == D3D_OK, "Setting fog table mode to D3DFOG_LINEAR returned %s\n", dx_error_string(hr));
         /* Transformed, table fog != none, vertex anything: Use Z value as input to the fog
          * equation
          */
@@ -419,7 +432,7 @@ static void fog_test(IDirect3DDevice8 *device)
                                                      sizeof(transformed_2[0]));
 
         hr = IDirect3DDevice8_EndScene(device);
-        ok(hr == D3D_OK, "EndScene returned %s\n", DXGetErrorString8(hr));
+        ok(hr == D3D_OK, "EndScene returned %s\n", dx_error_string(hr));
     }
     else
     {
@@ -438,7 +451,7 @@ static void fog_test(IDirect3DDevice8 *device)
 
     /* Turn off the fog master switch to avoid confusing other tests */
     hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, FALSE);
-    ok(hr == D3D_OK, "Turning off fog calculations returned %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK, "Turning off fog calculations returned %s\n", dx_error_string(hr));
 }
 
 START_TEST(visual)
-- 
1.4.4.4




More information about the wine-patches mailing list