d3d8/tests: DXGetErrorString8() prints 'Unknown' for too many hresults which makes diagnosis impossible. So print the raw code instead.

This commit is contained in:
Francois Gouget 2007-08-09 17:23:01 +02:00 committed by Alexandre Julliard
parent c3624439c8
commit a9abf580b5
2 changed files with 175 additions and 175 deletions

View File

@ -50,7 +50,7 @@ static int get_refcount(IUnknown *object)
int rc_new = rc; \ int rc_new = rc; \
ok(tmp1 == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, tmp1); \ ok(tmp1 == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, tmp1); \
} else {\ } else {\
trace("%s failed: %s\n", c, DXGetErrorString8(r)); \ trace("%s failed: %#08x\n", c, r); \
} }
#define CHECK_RELEASE(obj,d,rc) \ #define CHECK_RELEASE(obj,d,rc) \
@ -86,8 +86,8 @@ static int get_refcount(IUnknown *object)
{ \ { \
void *container_ptr = (void *)0x1337c0d3; \ void *container_ptr = (void *)0x1337c0d3; \
hr = IDirect3DSurface8_GetContainer(obj, &iid, &container_ptr); \ hr = IDirect3DSurface8_GetContainer(obj, &iid, &container_ptr); \
ok(SUCCEEDED(hr) && container_ptr == expected, "GetContainer returned: hr %#x, container_ptr %p. " \ ok(SUCCEEDED(hr) && container_ptr == expected, "GetContainer returned: hr %#08x, container_ptr %p. " \
"Expected hr %#x, container_ptr %p\n", hr, container_ptr, S_OK, expected); \ "Expected hr %#08x, container_ptr %p\n", hr, container_ptr, S_OK, expected); \
if (container_ptr && container_ptr != (void *)0x1337c0d3) IUnknown_Release((IUnknown *)container_ptr); \ if (container_ptr && container_ptr != (void *)0x1337c0d3) IUnknown_Release((IUnknown *)container_ptr); \
} }
@ -104,7 +104,7 @@ static void check_mipmap_levels(
DWORD levels = IDirect3DBaseTexture8_GetLevelCount(texture); DWORD levels = IDirect3DBaseTexture8_GetLevelCount(texture);
ok(levels == count, "Invalid level count. Expected %d got %u\n", count, levels); ok(levels == count, "Invalid level count. Expected %d got %u\n", count, levels);
} else } else
trace("CreateTexture failed: %s\n", DXGetErrorString8(hr)); trace("CreateTexture failed: %#08x\n", hr);
if (texture) IUnknown_Release( texture ); if (texture) IUnknown_Release( texture );
} }
@ -136,7 +136,7 @@ static void test_mipmap_levels(void)
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
if(FAILED(hr)) if(FAILED(hr))
{ {
skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr); skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
goto cleanup; goto cleanup;
} }
@ -181,7 +181,7 @@ static void test_swapchain(void)
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
if(FAILED(hr)) if(FAILED(hr))
{ {
skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr); skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
goto cleanup; goto cleanup;
} }
@ -191,39 +191,39 @@ static void test_swapchain(void)
/* Create a bunch of swapchains */ /* Create a bunch of swapchains */
d3dpp.BackBufferCount = 0; d3dpp.BackBufferCount = 0;
hr = IDirect3DDevice8_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain1); 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 (%#08x)\n", hr);
ok(d3dpp.BackBufferCount == 1, "The back buffer count in the presentparams struct is %d\n", d3dpp.BackBufferCount); ok(d3dpp.BackBufferCount == 1, "The back buffer count in the presentparams struct is %d\n", d3dpp.BackBufferCount);
d3dpp.BackBufferCount = 1; d3dpp.BackBufferCount = 1;
hr = IDirect3DDevice8_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain2); 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 (%#08x)\n", hr);
d3dpp.BackBufferCount = 2; d3dpp.BackBufferCount = 2;
hr = IDirect3DDevice8_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain3); 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 (%#08x)\n", hr);
if(SUCCEEDED(hr)) { if(SUCCEEDED(hr)) {
/* Swapchain 3, created with backbuffercount 2 */ /* Swapchain 3, created with backbuffercount 2 */
backbuffer = (void *) 0xdeadbeef; backbuffer = (void *) 0xdeadbeef;
hr = IDirect3DSwapChain8_GetBackBuffer(swapchain3, 0, 0, &backbuffer); 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 (%#08x)\n", hr);
ok(backbuffer != NULL && backbuffer != (void *) 0xdeadbeef, "The back buffer is %p\n", backbuffer); ok(backbuffer != NULL && backbuffer != (void *) 0xdeadbeef, "The back buffer is %p\n", backbuffer);
if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer); if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
backbuffer = (void *) 0xdeadbeef; backbuffer = (void *) 0xdeadbeef;
hr = IDirect3DSwapChain8_GetBackBuffer(swapchain3, 1, 0, &backbuffer); 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 (%#08x)\n", hr);
ok(backbuffer != NULL && backbuffer != (void *) 0xdeadbeef, "The back buffer is %p\n", backbuffer); ok(backbuffer != NULL && backbuffer != (void *) 0xdeadbeef, "The back buffer is %p\n", backbuffer);
if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer); if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
backbuffer = (void *) 0xdeadbeef; backbuffer = (void *) 0xdeadbeef;
hr = IDirect3DSwapChain8_GetBackBuffer(swapchain3, 2, 0, &backbuffer); hr = IDirect3DSwapChain8_GetBackBuffer(swapchain3, 2, 0, &backbuffer);
ok(hr == D3DERR_INVALIDCALL, "GetBackBuffer returned %s\n", DXGetErrorString8(hr)); ok(hr == D3DERR_INVALIDCALL, "GetBackBuffer returned %#08x\n", hr);
ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer); ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer); if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
backbuffer = (void *) 0xdeadbeef; backbuffer = (void *) 0xdeadbeef;
hr = IDirect3DSwapChain8_GetBackBuffer(swapchain3, 3, 0, &backbuffer); 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 (%#08x)\n", hr);
ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer); ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer); if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
} }
@ -231,32 +231,32 @@ static void test_swapchain(void)
/* Check the back buffers of the swapchains */ /* Check the back buffers of the swapchains */
/* Swapchain 1, created with backbuffercount 0 */ /* Swapchain 1, created with backbuffercount 0 */
hr = IDirect3DSwapChain8_GetBackBuffer(swapchain1, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); hr = IDirect3DSwapChain8_GetBackBuffer(swapchain1, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);
ok(SUCCEEDED(hr), "Failed to get the back buffer (%s)\n", DXGetErrorString8(hr)); ok(SUCCEEDED(hr), "Failed to get the back buffer (%#08x)\n", hr);
ok(backbuffer != NULL, "The back buffer is NULL (%s)\n", DXGetErrorString8(hr)); ok(backbuffer != NULL, "The back buffer is NULL (%#08x)\n", hr);
if(backbuffer) IDirect3DSurface8_Release(backbuffer); if(backbuffer) IDirect3DSurface8_Release(backbuffer);
backbuffer = (void *) 0xdeadbeef; backbuffer = (void *) 0xdeadbeef;
hr = IDirect3DSwapChain8_GetBackBuffer(swapchain1, 1, 0, &backbuffer); 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 (%#08x)\n", hr);
ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer); ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer); if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
/* Swapchain 2 - created with backbuffercount 1 */ /* Swapchain 2 - created with backbuffercount 1 */
backbuffer = (void *) 0xdeadbeef; backbuffer = (void *) 0xdeadbeef;
hr = IDirect3DSwapChain8_GetBackBuffer(swapchain2, 0, 0, &backbuffer); 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 (%#08x)\n", hr);
ok(backbuffer != NULL && backbuffer != (void *) 0xdeadbeef, "The back buffer is %p\n", backbuffer); ok(backbuffer != NULL && backbuffer != (void *) 0xdeadbeef, "The back buffer is %p\n", backbuffer);
if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer); if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
backbuffer = (void *) 0xdeadbeef; backbuffer = (void *) 0xdeadbeef;
hr = IDirect3DSwapChain8_GetBackBuffer(swapchain2, 1, 0, &backbuffer); hr = IDirect3DSwapChain8_GetBackBuffer(swapchain2, 1, 0, &backbuffer);
ok(hr == D3DERR_INVALIDCALL, "GetBackBuffer returned %s\n", DXGetErrorString8(hr)); ok(hr == D3DERR_INVALIDCALL, "GetBackBuffer returned %#08x\n", hr);
ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer); ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer); if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
backbuffer = (void *) 0xdeadbeef; backbuffer = (void *) 0xdeadbeef;
hr = IDirect3DSwapChain8_GetBackBuffer(swapchain2, 2, 0, &backbuffer); 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 (%#08x)\n", hr);
ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer); ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer); if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
@ -324,7 +324,7 @@ static void test_refcount(void)
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
if(FAILED(hr)) if(FAILED(hr))
{ {
skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr); skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
goto cleanup; goto cleanup;
} }
IDirect3DDevice8_GetDeviceCaps(pDevice, &caps); IDirect3DDevice8_GetDeviceCaps(pDevice, &caps);
@ -555,13 +555,13 @@ static void test_refcount(void)
BYTE *data; BYTE *data;
/* Vertex buffers can be locked multiple times */ /* Vertex buffers can be locked multiple times */
hr = IDirect3DVertexBuffer8_Lock(pVertexBuffer, 0, 0, &data, 0); hr = IDirect3DVertexBuffer8_Lock(pVertexBuffer, 0, 0, &data, 0);
ok(hr == D3D_OK, "IDirect3DVertexBuffer8::Lock failed with %08x\n", hr); ok(hr == D3D_OK, "IDirect3DVertexBuffer8::Lock failed with %#08x\n", hr);
hr = IDirect3DVertexBuffer8_Lock(pVertexBuffer, 0, 0, &data, 0); hr = IDirect3DVertexBuffer8_Lock(pVertexBuffer, 0, 0, &data, 0);
ok(hr == D3D_OK, "IDirect3DVertexBuffer8::Lock failed with %08x\n", hr); ok(hr == D3D_OK, "IDirect3DVertexBuffer8::Lock failed with %#08x\n", hr);
hr = IDirect3DVertexBuffer8_Unlock(pVertexBuffer); hr = IDirect3DVertexBuffer8_Unlock(pVertexBuffer);
ok(hr == D3D_OK, "IDirect3DVertexBuffer8::Unlock failed with %08x\n", hr); ok(hr == D3D_OK, "IDirect3DVertexBuffer8::Unlock failed with %#08x\n", hr);
hr = IDirect3DVertexBuffer8_Unlock(pVertexBuffer); hr = IDirect3DVertexBuffer8_Unlock(pVertexBuffer);
ok(hr == D3D_OK, "IDirect3DVertexBuffer8::Unlock failed with %08x\n", hr); ok(hr == D3D_OK, "IDirect3DVertexBuffer8::Unlock failed with %#08x\n", hr);
} }
/* The implicit render target is not freed if refcount reaches 0. /* The implicit render target is not freed if refcount reaches 0.
@ -638,50 +638,50 @@ static void test_cursor(void)
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
if(FAILED(hr)) if(FAILED(hr))
{ {
skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr); skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
goto cleanup; goto cleanup;
} }
IDirect3DDevice8_CreateImageSurface(pDevice, 32, 32, D3DFMT_A8R8G8B8, &cursor); IDirect3DDevice8_CreateImageSurface(pDevice, 32, 32, D3DFMT_A8R8G8B8, &cursor);
ok(cursor != NULL, "IDirect3DDevice8_CreateOffscreenPlainSurface failed with %08x\n", hr); ok(cursor != NULL, "IDirect3DDevice8_CreateOffscreenPlainSurface failed with %#08x\n", hr);
/* Initially hidden */ /* Initially hidden */
hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE); hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE);
ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %08x\n", hr); ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %#08x\n", hr);
/* Not enabled without a surface*/ /* Not enabled without a surface*/
hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE); hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE);
ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %08x\n", hr); ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %#08x\n", hr);
/* Fails */ /* Fails */
hr = IDirect3DDevice8_SetCursorProperties(pDevice, 0, 0, NULL); hr = IDirect3DDevice8_SetCursorProperties(pDevice, 0, 0, NULL);
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_SetCursorProperties returned %08x\n", hr); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_SetCursorProperties returned %#08x\n", hr);
hr = IDirect3DDevice8_SetCursorProperties(pDevice, 0, 0, cursor); hr = IDirect3DDevice8_SetCursorProperties(pDevice, 0, 0, cursor);
ok(hr == D3D_OK, "IDirect3DDevice8_SetCursorProperties returned %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_SetCursorProperties returned %#08x\n", hr);
IDirect3DSurface8_Release(cursor); IDirect3DSurface8_Release(cursor);
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
info.cbSize = sizeof(info); info.cbSize = sizeof(info);
hr = GetCursorInfo(&info); hr = GetCursorInfo(&info);
ok(hr != 0, "GetCursorInfo returned %08x\n", hr); ok(hr != 0, "GetCursorInfo returned %#08x\n", hr);
ok(info.flags & CURSOR_SHOWING, "The gdi cursor is hidden (%08x)\n", info.flags); ok(info.flags & CURSOR_SHOWING, "The gdi cursor is hidden (%08x)\n", info.flags);
ok(info.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */ ok(info.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */
/* Still hidden */ /* Still hidden */
hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE); hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE);
ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %08x\n", hr); ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %#08x\n", hr);
/* Enabled now*/ /* Enabled now*/
hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE); hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE);
ok(hr == TRUE, "IDirect3DDevice8_ShowCursor returned %08x\n", hr); ok(hr == TRUE, "IDirect3DDevice8_ShowCursor returned %#08x\n", hr);
/* GDI cursor unchanged */ /* GDI cursor unchanged */
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
info.cbSize = sizeof(info); info.cbSize = sizeof(info);
hr = GetCursorInfo(&info); hr = GetCursorInfo(&info);
ok(hr != 0, "GetCursorInfo returned %08x\n", hr); ok(hr != 0, "GetCursorInfo returned %#08x\n", hr);
ok(info.flags & CURSOR_SHOWING, "The gdi cursor is hidden (%08x)\n", info.flags); ok(info.flags & CURSOR_SHOWING, "The gdi cursor is hidden (%08x)\n", info.flags);
ok(info.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */ ok(info.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */
@ -717,14 +717,14 @@ static void test_states(void)
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
if(FAILED(hr)) if(FAILED(hr))
{ {
skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr); skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
goto cleanup; goto cleanup;
} }
hr = IDirect3DDevice8_SetRenderState(pDevice, D3DRS_ZVISIBLE, TRUE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(pDevice, D3DRS_ZVISIBLE, FALSE); 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 %#08x\n", hr);
cleanup: cleanup:
if(pD3d) IDirect3D8_Release(pD3d); if(pD3d) IDirect3D8_Release(pD3d);
@ -741,7 +741,7 @@ static void test_shader_versions(void)
ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n");
if (pD3d != NULL) { if (pD3d != NULL) {
hr = IDirect3D8_GetDeviceCaps(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dcaps); hr = IDirect3D8_GetDeviceCaps(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dcaps);
ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE, "Failed to get D3D8 caps (%08x)\n", hr); ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE, "Failed to get D3D8 caps (%#08x)\n", hr);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
ok(d3dcaps.VertexShaderVersion <= D3DVS_VERSION(1,1), "Unexpected VertexShaderVersion (%#x > %#x)\n", d3dcaps.VertexShaderVersion, D3DVS_VERSION(1,1)); 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)); ok(d3dcaps.PixelShaderVersion <= D3DPS_VERSION(1,4), "Unexpected PixelShaderVersion (%#x > %#x)\n", d3dcaps.PixelShaderVersion, D3DPS_VERSION(1,4));
@ -770,7 +770,7 @@ static void test_display_modes(void)
for(i=0; i<max_modes;i++) { for(i=0; i<max_modes;i++) {
res = IDirect3D8_EnumAdapterModes(pD3d, D3DADAPTER_DEFAULT, i, &dmode); 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 %#08x for mode %u!\n", res, i);
if(res != D3D_OK) if(res != D3D_OK)
continue; continue;
@ -807,39 +807,39 @@ static void test_scene(void)
hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D8_CreateDevice failed with %08x\n", hr); ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D8_CreateDevice failed with %#08x\n", hr);
if(!pDevice) if(!pDevice)
{ {
skip("could not create device, IDirect3D8_CreateDevice returned %08x\n", hr); skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
goto cleanup; goto cleanup;
} }
/* Test an EndScene without beginscene. Should return an error */ /* Test an EndScene without beginscene. Should return an error */
hr = IDirect3DDevice8_EndScene(pDevice); hr = IDirect3DDevice8_EndScene(pDevice);
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %s\n", DXGetErrorString8(hr)); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %#08x\n", hr);
/* Test a normal BeginScene / EndScene pair, this should work */ /* Test a normal BeginScene / EndScene pair, this should work */
hr = IDirect3DDevice8_BeginScene(pDevice); hr = IDirect3DDevice8_BeginScene(pDevice);
ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %#08x\n", hr);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
hr = IDirect3DDevice8_EndScene(pDevice); hr = IDirect3DDevice8_EndScene(pDevice);
ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %#08x\n", hr);
} }
/* Test another EndScene without having begun a new scene. Should return an error */ /* Test another EndScene without having begun a new scene. Should return an error */
hr = IDirect3DDevice8_EndScene(pDevice); hr = IDirect3DDevice8_EndScene(pDevice);
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %s\n", DXGetErrorString8(hr)); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %#08x\n", hr);
/* Two nested BeginScene and EndScene calls */ /* Two nested BeginScene and EndScene calls */
hr = IDirect3DDevice8_BeginScene(pDevice); hr = IDirect3DDevice8_BeginScene(pDevice);
ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %#08x\n", hr);
hr = IDirect3DDevice8_BeginScene(pDevice); hr = IDirect3DDevice8_BeginScene(pDevice);
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_BeginScene returned %s\n", DXGetErrorString8(hr)); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_BeginScene returned %#08x\n", hr);
hr = IDirect3DDevice8_EndScene(pDevice); hr = IDirect3DDevice8_EndScene(pDevice);
ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %#08x\n", hr);
hr = IDirect3DDevice8_EndScene(pDevice); hr = IDirect3DDevice8_EndScene(pDevice);
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %s\n", DXGetErrorString8(hr)); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_EndScene returned %#08x\n", hr);
/* StretchRect does not exit in Direct3D8, so no equivalent to the d3d9 stretchrect tests */ /* StretchRect does not exit in Direct3D8, so no equivalent to the d3d9 stretchrect tests */
@ -891,121 +891,121 @@ static void test_shader(void)
hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D8_CreateDevice failed with %08x\n", hr); ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D8_CreateDevice failed with %#08x\n", hr);
if(!pDevice) if(!pDevice)
{ {
skip("could not create device, IDirect3D8_CreateDevice returned %08x\n", hr); skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
goto cleanup; goto cleanup;
} }
IDirect3DDevice8_GetDeviceCaps(pDevice, &caps); IDirect3DDevice8_GetDeviceCaps(pDevice, &caps);
/* First create a vertex shader */ /* First create a vertex shader */
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, simple_vs, &hVertexShader, 0); 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 %#08x\n", hr);
/* Msdn says that the new vertex shader is set immediately. This is wrong, apparently */ /* Msdn says that the new vertex shader is set immediately. This is wrong, apparently */
hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle); hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle);
ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %#08x\n", hr);
ok(hTempHandle == 0, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, 0); ok(hTempHandle == 0, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, 0);
/* Assign the shader, then verify that GetVertexShader works */ /* Assign the shader, then verify that GetVertexShader works */
hr = IDirect3DDevice8_SetVertexShader(pDevice, hVertexShader); hr = IDirect3DDevice8_SetVertexShader(pDevice, hVertexShader);
ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %#08x\n", hr);
hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle); hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle);
ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %#08x\n", hr);
ok(hTempHandle == hVertexShader, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, hVertexShader); ok(hTempHandle == hVertexShader, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, hVertexShader);
/* Verify that we can retrieve the declaration */ /* Verify that we can retrieve the declaration */
hr = IDirect3DDevice8_GetVertexShaderDeclaration(pDevice, hVertexShader, NULL, &data_size); 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 %#08x\n", hr);
ok(data_size == vertex_decl_size, "Got data_size %u, expected %u\n", data_size, vertex_decl_size); 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 = HeapAlloc(GetProcessHeap(), 0, vertex_decl_size);
data_size = 1; data_size = 1;
hr = IDirect3DDevice8_GetVertexShaderDeclaration(pDevice, hVertexShader, data, &data_size); hr = IDirect3DDevice8_GetVertexShaderDeclaration(pDevice, hVertexShader, data, &data_size);
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetVertexShaderDeclaration returned %s (0x%#x), " ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetVertexShaderDeclaration returned (%#08x), "
"expected D3DERR_INVALIDCALL\n", DXGetErrorString8(hr), hr); "expected D3DERR_INVALIDCALL\n", hr);
ok(data_size == 1, "Got data_size %u, expected 1\n", data_size); ok(data_size == 1, "Got data_size %u, expected 1\n", data_size);
data_size = vertex_decl_size; data_size = vertex_decl_size;
hr = IDirect3DDevice8_GetVertexShaderDeclaration(pDevice, hVertexShader, data, &data_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 %#08x\n", hr);
ok(data_size == vertex_decl_size, "Got data_size %u, expected %u\n", data_size, vertex_decl_size); 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"); ok(!memcmp(data, dwVertexDecl, vertex_decl_size), "data not equal to shader declaration\n");
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
/* Verify that we can retrieve the shader function */ /* Verify that we can retrieve the shader function */
hr = IDirect3DDevice8_GetVertexShaderFunction(pDevice, hVertexShader, NULL, &data_size); 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 %#08x\n", hr);
ok(data_size == simple_vs_size, "Got data_size %u, expected %u\n", data_size, simple_vs_size); 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 = HeapAlloc(GetProcessHeap(), 0, simple_vs_size);
data_size = 1; data_size = 1;
hr = IDirect3DDevice8_GetVertexShaderFunction(pDevice, hVertexShader, data, &data_size); hr = IDirect3DDevice8_GetVertexShaderFunction(pDevice, hVertexShader, data, &data_size);
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetVertexShaderFunction returned %s (0x%#x), " ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetVertexShaderFunction returned (%#08x), "
"expected D3DERR_INVALIDCALL\n", DXGetErrorString8(hr), hr); "expected D3DERR_INVALIDCALL\n", hr);
ok(data_size == 1, "Got data_size %u, expected 1\n", data_size); ok(data_size == 1, "Got data_size %u, expected 1\n", data_size);
data_size = simple_vs_size; data_size = simple_vs_size;
hr = IDirect3DDevice8_GetVertexShaderFunction(pDevice, hVertexShader, data, &data_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 %#08x\n", hr);
ok(data_size == simple_vs_size, "Got data_size %u, expected %u\n", data_size, simple_vs_size); 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"); ok(!memcmp(data, simple_vs, simple_vs_size), "data not equal to shader function\n");
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
/* Delete the assigned shader. This is supposed to work */ /* Delete the assigned shader. This is supposed to work */
hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader); hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader);
ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %#08x\n", hr);
/* The shader should be unset now */ /* The shader should be unset now */
hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle); hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle);
ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %#08x\n", hr);
ok(hTempHandle == 0, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, 0); ok(hTempHandle == 0, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, 0);
if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 0)) if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 0))
{ {
/* The same with a pixel shader */ /* The same with a pixel shader */
hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader); 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 %#08x\n", hr);
/* Msdn says that the new pixel shader is set immediately. This is wrong, apparently */ /* Msdn says that the new pixel shader is set immediately. This is wrong, apparently */
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle); hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %#08x\n", hr);
ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0); ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0);
/* Assign the shader, then verify that GetPixelShader works */ /* Assign the shader, then verify that GetPixelShader works */
hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader); hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader);
ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %#08x\n", hr);
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle); hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %#08x\n", hr);
ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader); ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader);
/* Verify that we can retrieve the shader function */ /* Verify that we can retrieve the shader function */
hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, NULL, &data_size); hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, NULL, &data_size);
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFucntion returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFunction returned %#08x\n", hr);
ok(data_size == simple_ps_size, "Got data_size %u, expected %u\n", data_size, simple_ps_size); 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 = HeapAlloc(GetProcessHeap(), 0, simple_ps_size);
data_size = 1; data_size = 1;
hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_size); hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_size);
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetPixelShaderFunction returned %s (0x%#x), " ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetPixelShaderFunction returned (%#08x), "
"expected D3DERR_INVALIDCALL\n", DXGetErrorString8(hr), hr); "expected D3DERR_INVALIDCALL\n", hr);
ok(data_size == 1, "Got data_size %u, expected 1\n", data_size); ok(data_size == 1, "Got data_size %u, expected 1\n", data_size);
data_size = simple_ps_size; data_size = simple_ps_size;
hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_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 %#08x\n", hr);
ok(data_size == simple_ps_size, "Got data_size %u, expected %u\n", data_size, simple_ps_size); 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"); ok(!memcmp(data, simple_ps, simple_ps_size), "data not equal to shader function\n");
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
/* Delete the assigned shader. This is supposed to work */ /* Delete the assigned shader. This is supposed to work */
hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader); hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader);
ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %#08x\n", hr);
/* The shader should be unset now */ /* The shader should be unset now */
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle); hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %#08x\n", hr);
ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0); ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0);
/* What happens if a non-bound shader is deleted? */ /* What happens if a non-bound shader is deleted? */
hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader); 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 %#08x\n", hr);
hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader2); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader); hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader);
ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %#08x\n", hr);
hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader2); hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader2);
ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %#08x\n", hr);
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle); hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %#08x\n", hr);
ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader); ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader);
hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader); hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader);
ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %#08x\n", hr);
} }
else else
{ {
@ -1014,19 +1014,19 @@ static void test_shader(void)
/* What happens if a non-bound shader is deleted? */ /* What happens if a non-bound shader is deleted? */
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader, 0); 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 %#08x\n", hr);
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader2, 0); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetVertexShader(pDevice, hVertexShader); hr = IDirect3DDevice8_SetVertexShader(pDevice, hVertexShader);
ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %#08x\n", hr);
hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader2); hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader2);
ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %#08x\n", hr);
hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle); hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle);
ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %#08x\n", hr);
ok(hTempHandle == hVertexShader, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, hVertexShader); ok(hTempHandle == hVertexShader, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, hVertexShader);
hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader); hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader);
ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %#08x\n", hr);
cleanup: cleanup:
if(pD3d) IDirect3D8_Release(pD3d); if(pD3d) IDirect3D8_Release(pD3d);
@ -1063,25 +1063,25 @@ static void test_limits(void)
hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D8_CreateDevice failed with %08x\n", hr); ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D8_CreateDevice failed with %#08x\n", hr);
if(!pDevice) if(!pDevice)
{ {
skip("could not create device, IDirect3D8_CreateDevice returned %08x\n", hr); skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
goto cleanup; goto cleanup;
} }
hr = IDirect3DDevice8_CreateTexture(pDevice, 16, 16, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &pTexture); 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 %#08x\n", hr);
if(!pTexture) goto cleanup; if(!pTexture) goto cleanup;
/* There are 8 texture stages. We should be able to access all of them */ /* There are 8 texture stages. We should be able to access all of them */
for(i = 0; i < 8; i++) { for(i = 0; i < 8; i++) {
hr = IDirect3DDevice8_SetTexture(pDevice, i, (IDirect3DBaseTexture8 *) pTexture); 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 %#08x\n", i, hr);
hr = IDirect3DDevice8_SetTexture(pDevice, i, NULL); 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 %#08x\n", i, hr);
hr = IDirect3DDevice8_SetTextureStageState(pDevice, i, D3DTSS_COLOROP, D3DTOP_ADD); 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 %#08x\n", i, hr);
} }
/* Investigations show that accessing higher textures stage states does not return an error either. Writing /* Investigations show that accessing higher textures stage states does not return an error either. Writing

View File

@ -51,13 +51,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); hr = IDirect3DDevice8_CreateTexture(device, 640, 480, 1 /* Levels */, 0 /* usage */, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &tex);
if(FAILED(hr) || !tex ) /* This is not a test */ 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=%#08x\n", hr);
return 0xdeadbeef; return 0xdeadbeef;
} }
hr = IDirect3DTexture8_GetSurfaceLevel(tex, 0, &surf); hr = IDirect3DTexture8_GetSurfaceLevel(tex, 0, &surf);
if(FAILED(hr) || !tex ) /* This is not a test */ 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=%#08x\n", hr);
ret = 0xdeadbeee; ret = 0xdeadbeee;
goto out; goto out;
} }
@ -65,7 +65,7 @@ static DWORD getPixelColor(IDirect3DDevice8 *device, UINT x, UINT y)
hr = IDirect3DDevice8_GetFrontBuffer(device, surf); hr = IDirect3DDevice8_GetFrontBuffer(device, surf);
if(FAILED(hr)) 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=%#08x\n", hr);
ret = 0xdeadbeed; ret = 0xdeadbeed;
goto out; goto out;
} }
@ -73,7 +73,7 @@ static DWORD getPixelColor(IDirect3DDevice8 *device, UINT x, UINT y)
hr = IDirect3DSurface8_LockRect(surf, &lockedRect, &rectToLock, D3DLOCK_READONLY); hr = IDirect3DSurface8_LockRect(surf, &lockedRect, &rectToLock, D3DLOCK_READONLY);
if(FAILED(hr)) if(FAILED(hr))
{ {
trace("Can't lock the offscreen surface, hr=%s\n", DXGetErrorString8(hr)); trace("Can't lock the offscreen surface, hr=%#08x\n", hr);
ret = 0xdeadbeec; ret = 0xdeadbeec;
goto out; goto out;
} }
@ -84,7 +84,7 @@ static DWORD getPixelColor(IDirect3DDevice8 *device, UINT x, UINT y)
hr = IDirect3DSurface8_UnlockRect(surf); hr = IDirect3DSurface8_UnlockRect(surf);
if(FAILED(hr)) if(FAILED(hr))
{ {
trace("Can't unlock the offscreen surface, hr=%s\n", DXGetErrorString8(hr)); trace("Can't unlock the offscreen surface, hr=%#08x\n", hr);
} }
out: out:
@ -120,7 +120,7 @@ static IDirect3DDevice8 *init_d3d8(void)
present_parameters.AutoDepthStencilFormat = D3DFMT_D16; present_parameters.AutoDepthStencilFormat = D3DFMT_D16;
hr = IDirect3D8_CreateDevice(d3d8_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device_ptr); hr = IDirect3D8_CreateDevice(d3d8_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device_ptr);
ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D_CreateDevice returned: %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D_CreateDevice returned: %#08x\n", hr);
return device_ptr; return device_ptr;
} }
@ -181,69 +181,69 @@ static void lighting_test(IDirect3DDevice8 *device)
WORD Indices[] = {0, 1, 2, 2, 3, 0}; WORD Indices[] = {0, 1, 2, 2, 3, 0};
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 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 %#08x\n", hr);
/* Setup some states that may cause issues */ /* Setup some states that may cause issues */
hr = IDirect3DDevice8_SetTransform(device, D3DTS_WORLDMATRIX(0), (D3DMATRIX *) mat); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetTransform(device, D3DTS_VIEW, (D3DMATRIX *)mat); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, (D3DMATRIX *) mat); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_CLIPPING, FALSE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, FALSE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, FALSE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_STENCILENABLE, FALSE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ALPHATESTENABLE, FALSE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ALPHABLENDENABLE, FALSE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_NONE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetVertexShader(device, fvf); hr = IDirect3DDevice8_SetVertexShader(device, fvf);
ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %#08x\n", hr);
hr = IDirect3DDevice8_BeginScene(device); hr = IDirect3DDevice8_BeginScene(device);
ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene failed with %#08x\n", hr);
if(hr == D3D_OK) if(hr == D3D_OK)
{ {
/* No lights are defined... That means, lit vertices should be entirely black */ /* No lights are defined... That means, lit vertices should be entirely black */
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
2 /*PrimCount */, Indices, D3DFMT_INDEX16, unlitquad, sizeof(unlitquad[0])); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, TRUE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
2 /*PrimCount */, Indices, D3DFMT_INDEX16, litquad, sizeof(litquad[0])); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetVertexShader(device, nfvf); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
2 /*PrimCount */, Indices, D3DFMT_INDEX16, unlitnquad, sizeof(unlitnquad[0])); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, TRUE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
2 /*PrimCount */, Indices, D3DFMT_INDEX16, litnquad, sizeof(litnquad[0])); 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 %#08x\n", hr);
IDirect3DDevice8_EndScene(device); IDirect3DDevice8_EndScene(device);
ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_EndScene failed with %#08x\n", hr);
} }
IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
@ -258,7 +258,7 @@ static void lighting_test(IDirect3DDevice8 *device)
ok(color == 0x00000000, "Lit quad width normals has color %08x\n", color); ok(color == 0x00000000, "Lit quad width normals has color %08x\n", color);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); 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 %#08x\n", hr);
} }
static void clear_test(IDirect3DDevice8 *device) static void clear_test(IDirect3DDevice8 *device)
@ -270,7 +270,7 @@ static void clear_test(IDirect3DDevice8 *device)
DWORD color; DWORD color;
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 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 %#08x\n", hr);
/* Positive x, negative y */ /* Positive x, negative y */
rect[0].x1 = 0; rect[0].x1 = 0;
@ -287,7 +287,7 @@ static void clear_test(IDirect3DDevice8 *device)
* is ignored, the positive is still cleared afterwards * is ignored, the positive is still cleared afterwards
*/ */
hr = IDirect3DDevice8_Clear(device, 2, rect, D3DCLEAR_TARGET, 0xffff0000, 0.0, 0); 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 %#08x\n", hr);
/* negative x, negative y */ /* negative x, negative y */
rect_negneg.x1 = 640; rect_negneg.x1 = 640;
@ -295,7 +295,7 @@ static void clear_test(IDirect3DDevice8 *device)
rect_negneg.x2 = 320; rect_negneg.x2 = 320;
rect_negneg.y2 = 0; rect_negneg.y2 = 0;
hr = IDirect3DDevice8_Clear(device, 1, &rect_negneg, D3DCLEAR_TARGET, 0xff00ff00, 0.0, 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 %#08x\n", hr);
IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
@ -359,60 +359,60 @@ static void fog_test(IDirect3DDevice8 *device)
WORD Indices[] = {0, 1, 2, 2, 3, 0}; WORD Indices[] = {0, 1, 2, 2, 3, 0};
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff00ff, 0.0, 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 %#08x\n", hr);
/* Setup initial states: No lighting, fog on, fog color */ /* Setup initial states: No lighting, fog on, fog color */
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0xFF00FF00 /* A nice green */); 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 %#08x\n", hr);
/* First test: Both table fog and vertex fog off */ /* First test: Both table fog and vertex fog off */
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, D3DFOG_NONE); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_NONE); 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 %#08x\n", hr);
/* Start = 0, end = 1. Should be default, but set them */ /* Start = 0, end = 1. Should be default, but set them */
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, *((DWORD *) &start)); 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 %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, *((DWORD *) &end)); 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 %#08x\n", hr);
if(IDirect3DDevice8_BeginScene(device) == D3D_OK) if(IDirect3DDevice8_BeginScene(device) == D3D_OK)
{ {
hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR); 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 %#08x\n", hr);
/* Untransformed, vertex fog = NONE, table fog = NONE: Read the fog weighting from the specular color */ /* 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 */, hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
2 /*PrimCount */, Indices, D3DFMT_INDEX16, unstransformed_1, 2 /*PrimCount */, Indices, D3DFMT_INDEX16, unstransformed_1,
sizeof(unstransformed_1[0])); sizeof(unstransformed_1[0]));
ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %#08x\n", hr);
/* That makes it use the Z value */ /* That makes it use the Z value */
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); 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 %#08x\n", hr);
/* Untransformed, vertex fog != none (or table fog != none): /* Untransformed, vertex fog != none (or table fog != none):
* Use the Z value as input into the equation * Use the Z value as input into the equation
*/ */
hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
2 /*PrimCount */, Indices, D3DFMT_INDEX16, unstransformed_2, 2 /*PrimCount */, Indices, D3DFMT_INDEX16, unstransformed_2,
sizeof(unstransformed_1[0])); sizeof(unstransformed_1[0]));
ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %#08x\n", hr);
/* transformed verts */ /* transformed verts */
hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR); 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 %#08x\n", hr);
/* Transformed, vertex fog != NONE, pixel fog == NONE: Use specular color alpha component */ /* Transformed, vertex fog != NONE, pixel fog == NONE: Use specular color alpha component */
hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, hr = IDirect3DDevice8_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */,
2 /*PrimCount */, Indices, D3DFMT_INDEX16, transformed_1, 2 /*PrimCount */, Indices, D3DFMT_INDEX16, transformed_1,
sizeof(transformed_1[0])); sizeof(transformed_1[0]));
ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "DrawIndexedPrimitiveUP returned %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, D3DFOG_LINEAR); 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 %#08x\n", hr);
/* Transformed, table fog != none, vertex anything: Use Z value as input to the fog /* Transformed, table fog != none, vertex anything: Use Z value as input to the fog
* equation * equation
*/ */
@ -421,7 +421,7 @@ static void fog_test(IDirect3DDevice8 *device)
sizeof(transformed_2[0])); sizeof(transformed_2[0]));
hr = IDirect3DDevice8_EndScene(device); hr = IDirect3DDevice8_EndScene(device);
ok(hr == D3D_OK, "EndScene returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "EndScene returned %#08x\n", hr);
} }
else else
{ {
@ -440,7 +440,7 @@ static void fog_test(IDirect3DDevice8 *device)
/* Turn off the fog master switch to avoid confusing other tests */ /* Turn off the fog master switch to avoid confusing other tests */
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, FALSE); 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 %#08x\n", hr);
} }
static void present_test(IDirect3DDevice8 *device) static void present_test(IDirect3DDevice8 *device)
@ -488,7 +488,7 @@ static void present_test(IDirect3DDevice8 *device)
ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr); ok(SUCCEEDED(hr), "Present failed (%#08x)\n", hr);
color = getPixelColor(device, 512, 240); color = getPixelColor(device, 512, 240);
ok(color == 0x00ffffff, "Present failed: Got color 0x%08x, expected 0x00ffffff.\n", color); ok(color == 0x00ffffff, "Present failed: Got color 0x%08x, expected 0x00ffffff.\n", color);
color = getPixelColor(device, 64, 240); color = getPixelColor(device, 64, 240);
@ -544,27 +544,27 @@ static void test_rcp_rsq(IDirect3DDevice8 *device)
}; };
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff800080, 0.0, 0); hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff800080, 0.0, 0);
ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %#08x\n", hr);
hr = IDirect3DDevice8_CreateVertexShader(device, decl, rcp_test, &shader, 0); hr = IDirect3DDevice8_CreateVertexShader(device, decl, rcp_test, &shader, 0);
ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned with %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned with %#08x\n", hr);
IDirect3DDevice8_SetVertexShader(device, shader); IDirect3DDevice8_SetVertexShader(device, shader);
ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %#08x\n", hr);
IDirect3DDevice8_SetVertexShaderConstant(device, 0, constant, 1); IDirect3DDevice8_SetVertexShaderConstant(device, 0, constant, 1);
hr = IDirect3DDevice8_BeginScene(device); hr = IDirect3DDevice8_BeginScene(device);
ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene returned %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene returned %#08x\n", hr);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quad[0], 3 * sizeof(float)); hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quad[0], 3 * sizeof(float));
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr); ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#08x)\n", hr);
hr = IDirect3DDevice8_EndScene(device); hr = IDirect3DDevice8_EndScene(device);
ok(hr == D3D_OK, "IDirect3DDevice8_EndScene returned %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_EndScene returned %#08x\n", hr);
} }
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Present failed (%08x)\n", hr); ok(SUCCEEDED(hr), "Present failed (%#08x)\n", hr);
color = getPixelColor(device, 320, 240); color = getPixelColor(device, 320, 240);
c1 = (color & 0x00ff0000 )>> 16; c1 = (color & 0x00ff0000 )>> 16;
c2 = (color & 0x0000ff00 )>> 8; c2 = (color & 0x0000ff00 )>> 8;
@ -577,27 +577,27 @@ static void test_rcp_rsq(IDirect3DDevice8 *device)
IDirect3DDevice8_DeleteVertexShader(device, shader); IDirect3DDevice8_DeleteVertexShader(device, shader);
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff800080, 0.0, 0); hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff800080, 0.0, 0);
ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %#08x\n", hr);
hr = IDirect3DDevice8_CreateVertexShader(device, decl, rsq_test, &shader, 0); hr = IDirect3DDevice8_CreateVertexShader(device, decl, rsq_test, &shader, 0);
ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned with %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned with %#08x\n", hr);
IDirect3DDevice8_SetVertexShader(device, shader); IDirect3DDevice8_SetVertexShader(device, shader);
ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %#08x\n", hr);
IDirect3DDevice8_SetVertexShaderConstant(device, 0, constant, 1); IDirect3DDevice8_SetVertexShaderConstant(device, 0, constant, 1);
hr = IDirect3DDevice8_BeginScene(device); hr = IDirect3DDevice8_BeginScene(device);
ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene returned %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_BeginScene returned %#08x\n", hr);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quad[0], 3 * sizeof(float)); hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quad[0], 3 * sizeof(float));
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr); ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#08x)\n", hr);
hr = IDirect3DDevice8_EndScene(device); hr = IDirect3DDevice8_EndScene(device);
ok(hr == D3D_OK, "IDirect3DDevice8_EndScene returned %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_EndScene returned %#08x\n", hr);
} }
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Present failed (%08x)\n", hr); ok(SUCCEEDED(hr), "Present failed (%#08x)\n", hr);
color = getPixelColor(device, 320, 240); color = getPixelColor(device, 320, 240);
c1 = (color & 0x00ff0000 )>> 16; c1 = (color & 0x00ff0000 )>> 16;
c2 = (color & 0x0000ff00 )>> 8; c2 = (color & 0x0000ff00 )>> 8;
@ -625,17 +625,17 @@ static void offscreen_test(IDirect3DDevice8 *device)
}; };
hr = IDirect3DDevice8_GetDepthStencilSurface(device, &depthstencil); hr = IDirect3DDevice8_GetDepthStencilSurface(device, &depthstencil);
ok(hr == D3D_OK, "IDirect3DDevice8_GetDepthStencilSurface failed, hr = %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_GetDepthStencilSurface failed, hr = %#08x\n", hr);
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 0.0, 0); hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 0.0, 0);
ok(hr == D3D_OK, "Clear failed, hr = %08x\n", hr); ok(hr == D3D_OK, "Clear failed, hr = %#08x\n", hr);
hr = IDirect3DDevice8_CreateTexture(device, 128, 128, 1, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &offscreenTexture); hr = IDirect3DDevice8_CreateTexture(device, 128, 128, 1, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &offscreenTexture);
ok(hr == D3D_OK || D3DERR_INVALIDCALL, "Creating the offscreen render target failed, hr = %08x\n", hr); ok(hr == D3D_OK || D3DERR_INVALIDCALL, "Creating the offscreen render target failed, hr = %#08x\n", hr);
if(!offscreenTexture) { if(!offscreenTexture) {
trace("Failed to create an X8R8G8B8 offscreen texture, trying R5G6B5\n"); trace("Failed to create an X8R8G8B8 offscreen texture, trying R5G6B5\n");
hr = IDirect3DDevice8_CreateTexture(device, 128, 128, 1, D3DUSAGE_RENDERTARGET, D3DFMT_R5G6B5, D3DPOOL_DEFAULT, &offscreenTexture); hr = IDirect3DDevice8_CreateTexture(device, 128, 128, 1, D3DUSAGE_RENDERTARGET, D3DFMT_R5G6B5, D3DPOOL_DEFAULT, &offscreenTexture);
ok(hr == D3D_OK || D3DERR_INVALIDCALL, "Creating the offscreen render target failed, hr = %08x\n", hr); ok(hr == D3D_OK || D3DERR_INVALIDCALL, "Creating the offscreen render target failed, hr = %#08x\n", hr);
if(!offscreenTexture) { if(!offscreenTexture) {
skip("Cannot create an offscreen render target\n"); skip("Cannot create an offscreen render target\n");
goto out; goto out;
@ -643,49 +643,49 @@ static void offscreen_test(IDirect3DDevice8 *device)
} }
hr = IDirect3DDevice8_GetBackBuffer(device, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); hr = IDirect3DDevice8_GetBackBuffer(device, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);
ok(hr == D3D_OK, "Can't get back buffer, hr = %08x\n", hr); ok(hr == D3D_OK, "Can't get back buffer, hr = %#08x\n", hr);
if(!backbuffer) { if(!backbuffer) {
goto out; goto out;
} }
hr = IDirect3DTexture8_GetSurfaceLevel(offscreenTexture, 0, &offscreen); hr = IDirect3DTexture8_GetSurfaceLevel(offscreenTexture, 0, &offscreen);
ok(hr == D3D_OK, "Can't get offscreen surface, hr = %08x\n", hr); ok(hr == D3D_OK, "Can't get offscreen surface, hr = %#08x\n", hr);
if(!offscreen) { if(!offscreen) {
goto out; goto out;
} }
hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_TEX1); hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_TEX1);
ok(hr == D3D_OK, "SetVertexShader failed, hr = %08x\n", hr); ok(hr == D3D_OK, "SetVertexShader failed, hr = %#08x\n", hr);
hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
ok(hr == D3D_OK, "SetTextureStageState failed, hr = %08x\n", hr); ok(hr == D3D_OK, "SetTextureStageState failed, hr = %#08x\n", hr);
hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
ok(hr == D3D_OK, "SetTextureStageState failed, hr = %08x\n", hr); ok(hr == D3D_OK, "SetTextureStageState failed, hr = %#08x\n", hr);
hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_MINFILTER, D3DTEXF_NONE); hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_MINFILTER, D3DTEXF_NONE);
ok(SUCCEEDED(hr), "SetTextureStageState D3DSAMP_MINFILTER failed (0x%08x)\n", hr); ok(SUCCEEDED(hr), "SetTextureStageState D3DSAMP_MINFILTER failed (%#08x)\n", hr);
hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_MAGFILTER, D3DTEXF_NONE); hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_MAGFILTER, D3DTEXF_NONE);
ok(SUCCEEDED(hr), "SetTextureStageState D3DSAMP_MAGFILTER failed (0x%08x)\n", hr); ok(SUCCEEDED(hr), "SetTextureStageState D3DSAMP_MAGFILTER failed (%#08x)\n", hr);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); 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", DXGetErrorString8(hr));
if(IDirect3DDevice8_BeginScene(device) == D3D_OK) { if(IDirect3DDevice8_BeginScene(device) == D3D_OK) {
hr = IDirect3DDevice8_SetRenderTarget(device, offscreen, depthstencil); hr = IDirect3DDevice8_SetRenderTarget(device, offscreen, depthstencil);
ok(hr == D3D_OK, "SetRenderTarget failed, hr = %08x\n", hr); ok(hr == D3D_OK, "SetRenderTarget failed, hr = %#08x\n", hr);
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff00ff, 0.0, 0); hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff00ff, 0.0, 0);
ok(hr == D3D_OK, "Clear failed, hr = %08x\n", hr); ok(hr == D3D_OK, "Clear failed, hr = %#08x\n", hr);
/* Draw without textures - Should resut in a white quad */ /* Draw without textures - Should resut in a white quad */
hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0])); hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0]));
ok(hr == D3D_OK, "DrawPrimitiveUP failed, hr = %08x\n", hr); ok(hr == D3D_OK, "DrawPrimitiveUP failed, hr = %#08x\n", hr);
hr = IDirect3DDevice8_SetRenderTarget(device, backbuffer, depthstencil); hr = IDirect3DDevice8_SetRenderTarget(device, backbuffer, depthstencil);
ok(hr == D3D_OK, "SetRenderTarget failed, hr = %08x\n", hr); ok(hr == D3D_OK, "SetRenderTarget failed, hr = %#08x\n", hr);
hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *) offscreenTexture); hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *) offscreenTexture);
ok(hr == D3D_OK, "SetTexture failed, %s\n", DXGetErrorString8(hr)); ok(hr == D3D_OK, "SetTexture failed, %s\n", DXGetErrorString8(hr));
/* This time with the texture */ /* This time with the texture */
hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0])); hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0]));
ok(hr == D3D_OK, "DrawPrimitiveUP failed, hr = %08x\n", hr); ok(hr == D3D_OK, "DrawPrimitiveUP failed, hr = %#08x\n", hr);
IDirect3DDevice8_EndScene(device); IDirect3DDevice8_EndScene(device);
} }