d3d8/tests: DXGetErrorString8() prints 'Unknown' for too many hresults which makes diagnosis impossible. So print the raw code instead.
This commit is contained in:
parent
c3624439c8
commit
a9abf580b5
|
@ -50,7 +50,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: %#08x\n", c, r); \
|
||||
}
|
||||
|
||||
#define CHECK_RELEASE(obj,d,rc) \
|
||||
|
@ -86,8 +86,8 @@ static int get_refcount(IUnknown *object)
|
|||
{ \
|
||||
void *container_ptr = (void *)0x1337c0d3; \
|
||||
hr = IDirect3DSurface8_GetContainer(obj, &iid, &container_ptr); \
|
||||
ok(SUCCEEDED(hr) && container_ptr == expected, "GetContainer returned: hr %#x, container_ptr %p. " \
|
||||
"Expected hr %#x, container_ptr %p\n", hr, container_ptr, S_OK, expected); \
|
||||
ok(SUCCEEDED(hr) && container_ptr == expected, "GetContainer returned: hr %#08x, container_ptr %p. " \
|
||||
"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); \
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,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: %#08x\n", hr);
|
||||
|
||||
if (texture) IUnknown_Release( texture );
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ static void test_mipmap_levels(void)
|
|||
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ static void test_swapchain(void)
|
|||
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -191,39 +191,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 (%#08x)\n", 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 (%#08x)\n", 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 (%#08x)\n", 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 (%#08x)\n", 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 (%#08x)\n", 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 %#08x\n", 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 (%#08x)\n", hr);
|
||||
ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", 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 */
|
||||
/* 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 (%#08x)\n", hr);
|
||||
ok(backbuffer != NULL, "The back buffer is NULL (%#08x)\n", 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 (%#08x)\n", 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 (%#08x)\n", 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 %#08x\n", 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 (%#08x)\n", hr);
|
||||
ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer);
|
||||
if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer);
|
||||
|
||||
|
@ -324,7 +324,7 @@ static void test_refcount(void)
|
|||
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
|
||||
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;
|
||||
}
|
||||
IDirect3DDevice8_GetDeviceCaps(pDevice, &caps);
|
||||
|
@ -555,13 +555,13 @@ static void test_refcount(void)
|
|||
BYTE *data;
|
||||
/* Vertex buffers can be locked multiple times */
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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.
|
||||
|
@ -638,50 +638,50 @@ static void test_cursor(void)
|
|||
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
|
||||
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;
|
||||
}
|
||||
|
||||
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 */
|
||||
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*/
|
||||
hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE);
|
||||
ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %08x\n", hr);
|
||||
ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %#08x\n", hr);
|
||||
|
||||
/* Fails */
|
||||
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);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice8_SetCursorProperties returned %08x\n", hr);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice8_SetCursorProperties returned %#08x\n", hr);
|
||||
|
||||
IDirect3DSurface8_Release(cursor);
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.cbSize = sizeof(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.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */
|
||||
|
||||
/* Still hidden */
|
||||
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*/
|
||||
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 */
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.cbSize = sizeof(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.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 );
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
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:
|
||||
if(pD3d) IDirect3D8_Release(pD3d);
|
||||
|
@ -741,7 +741,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) || 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)) {
|
||||
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));
|
||||
|
@ -770,7 +770,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 %#08x for mode %u!\n", res, i);
|
||||
if(res != D3D_OK)
|
||||
continue;
|
||||
|
||||
|
@ -807,39 +807,39 @@ 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 || 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)
|
||||
{
|
||||
skip("could not create device, IDirect3D8_CreateDevice returned %08x\n", hr);
|
||||
skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
|
||||
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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", hr);
|
||||
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);
|
||||
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);
|
||||
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 */
|
||||
|
||||
|
@ -891,121 +891,121 @@ 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 || 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)
|
||||
{
|
||||
skip("could not create device, IDirect3D8_CreateDevice returned %08x\n", hr);
|
||||
skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
|
||||
goto cleanup;
|
||||
}
|
||||
IDirect3DDevice8_GetDeviceCaps(pDevice, &caps);
|
||||
|
||||
/* 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", hr);
|
||||
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);
|
||||
/* 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 %#08x\n", 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);
|
||||
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetVertexShaderDeclaration returned (%#08x), "
|
||||
"expected D3DERR_INVALIDCALL\n", 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 %#08x\n", 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 %#08x\n", 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);
|
||||
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetVertexShaderFunction returned (%#08x), "
|
||||
"expected D3DERR_INVALIDCALL\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", hr);
|
||||
ok(hTempHandle == 0, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, 0);
|
||||
|
||||
if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", hr);
|
||||
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);
|
||||
/* 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_GetPixelShaderFunction returned %#08x\n", 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);
|
||||
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetPixelShaderFunction returned (%#08x), "
|
||||
"expected D3DERR_INVALIDCALL\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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_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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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
|
||||
{
|
||||
|
@ -1014,19 +1014,19 @@ static void test_shader(void)
|
|||
|
||||
/* 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 %#08x\n", 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 %#08x\n", hr);
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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:
|
||||
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,
|
||||
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)
|
||||
{
|
||||
skip("could not create device, IDirect3D8_CreateDevice returned %08x\n", hr);
|
||||
skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr);
|
||||
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 %#08x\n", 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 %#08x\n", i, 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 %#08x\n", i, 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 %#08x\n", i, hr);
|
||||
}
|
||||
|
||||
/* Investigations show that accessing higher textures stage states does not return an error either. Writing
|
||||
|
|
|
@ -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);
|
||||
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;
|
||||
}
|
||||
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=%#08x\n", hr);
|
||||
ret = 0xdeadbeee;
|
||||
goto out;
|
||||
}
|
||||
|
@ -65,7 +65,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=%#08x\n", hr);
|
||||
ret = 0xdeadbeed;
|
||||
goto out;
|
||||
}
|
||||
|
@ -73,7 +73,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=%#08x\n", hr);
|
||||
ret = 0xdeadbeec;
|
||||
goto out;
|
||||
}
|
||||
|
@ -84,7 +84,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=%#08x\n", hr);
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -120,7 +120,7 @@ static IDirect3DDevice8 *init_d3d8(void)
|
|||
present_parameters.AutoDepthStencilFormat = D3DFMT_D16;
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -181,69 +181,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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", hr);
|
||||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
/* 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", hr);
|
||||
|
||||
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);
|
||||
|
@ -258,7 +258,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 %#08x\n", hr);
|
||||
}
|
||||
|
||||
static void clear_test(IDirect3DDevice8 *device)
|
||||
|
@ -270,7 +270,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 %#08x\n", hr);
|
||||
|
||||
/* Positive x, negative y */
|
||||
rect[0].x1 = 0;
|
||||
|
@ -287,7 +287,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 %#08x\n", hr);
|
||||
|
||||
/* negative x, negative y */
|
||||
rect_negneg.x1 = 640;
|
||||
|
@ -295,7 +295,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 %#08x\n", hr);
|
||||
|
||||
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};
|
||||
|
||||
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 */
|
||||
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);
|
||||
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 */);
|
||||
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 */
|
||||
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);
|
||||
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 */
|
||||
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));
|
||||
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)
|
||||
{
|
||||
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 */
|
||||
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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", 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 %#08x\n", hr);
|
||||
/* Transformed, table fog != none, vertex anything: Use Z value as input to the fog
|
||||
* equation
|
||||
*/
|
||||
|
@ -421,7 +421,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 %#08x\n", hr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -440,7 +440,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 %#08x\n", hr);
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
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);
|
||||
ok(color == 0x00ffffff, "Present failed: Got color 0x%08x, expected 0x00ffffff.\n", color);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
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))
|
||||
{
|
||||
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);
|
||||
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);
|
||||
ok(SUCCEEDED(hr), "Present failed (%08x)\n", hr);
|
||||
ok(SUCCEEDED(hr), "Present failed (%#08x)\n", hr);
|
||||
color = getPixelColor(device, 320, 240);
|
||||
c1 = (color & 0x00ff0000 )>> 16;
|
||||
c2 = (color & 0x0000ff00 )>> 8;
|
||||
|
@ -577,27 +577,27 @@ static void test_rcp_rsq(IDirect3DDevice8 *device)
|
|||
IDirect3DDevice8_DeleteVertexShader(device, shader);
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
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))
|
||||
{
|
||||
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);
|
||||
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);
|
||||
ok(SUCCEEDED(hr), "Present failed (%08x)\n", hr);
|
||||
ok(SUCCEEDED(hr), "Present failed (%#08x)\n", hr);
|
||||
color = getPixelColor(device, 320, 240);
|
||||
c1 = (color & 0x00ff0000 )>> 16;
|
||||
c2 = (color & 0x0000ff00 )>> 8;
|
||||
|
@ -625,17 +625,17 @@ static void offscreen_test(IDirect3DDevice8 *device)
|
|||
};
|
||||
|
||||
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);
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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) {
|
||||
skip("Cannot create an offscreen render target\n");
|
||||
goto out;
|
||||
|
@ -643,49 +643,49 @@ static void offscreen_test(IDirect3DDevice8 *device)
|
|||
}
|
||||
|
||||
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) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
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) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %s\n", DXGetErrorString8(hr));
|
||||
|
||||
if(IDirect3DDevice8_BeginScene(device) == D3D_OK) {
|
||||
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);
|
||||
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 */
|
||||
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);
|
||||
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);
|
||||
ok(hr == D3D_OK, "SetTexture failed, %s\n", DXGetErrorString8(hr));
|
||||
|
||||
/* This time with the texture */
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue