Commit c6bc9e01 authored by Ričardas Barkauskas's avatar Ričardas Barkauskas Committed by Alexandre Julliard

ddraw/tests: Test if surface with DDSCAPS_ZBUFFER can be render target.

parent 743e9b35
......@@ -3133,9 +3133,9 @@ static void ComputeSphereVisibility(void)
static void SetRenderTargetTest(void)
{
HRESULT hr;
IDirectDrawSurface7 *newrt, *oldrt;
IDirectDrawSurface7 *newrt, *failrt, *oldrt;
D3DVIEWPORT7 vp;
DDSURFACEDESC2 ddsd;
DDSURFACEDESC2 ddsd, ddsd2;
DWORD stateblock;
memset(&ddsd, 0, sizeof(ddsd));
......@@ -3144,6 +3144,7 @@ static void SetRenderTargetTest(void)
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE;
ddsd.dwWidth = 64;
ddsd.dwHeight = 64;
hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &newrt, NULL);
ok(hr == DD_OK, "IDirectDraw7_CreateSurface failed, hr=0x%08x\n", hr);
if(FAILED(hr))
......@@ -3152,6 +3153,20 @@ static void SetRenderTargetTest(void)
return;
}
memset(&ddsd2, 0, sizeof(ddsd2));
ddsd2.dwSize = sizeof(ddsd2);
ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
ddsd2.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER;
ddsd2.dwWidth = 64;
ddsd2.dwHeight = 64;
U4(ddsd2).ddpfPixelFormat.dwSize = sizeof(U4(ddsd2).ddpfPixelFormat);
U4(ddsd2).ddpfPixelFormat.dwFlags = DDPF_ZBUFFER;
U1(U4(ddsd2).ddpfPixelFormat).dwZBufferBitDepth = 16;
U3(U4(ddsd2).ddpfPixelFormat).dwZBitMask = 0x0000FFFF;
hr = IDirectDraw7_CreateSurface(lpDD, &ddsd2, &failrt, NULL);
ok(hr == DD_OK, "IDirectDraw7_CreateSurface failed, hr=0x%08x\n", hr);
memset(&vp, 0, sizeof(vp));
vp.dwX = 10;
vp.dwY = 10;
......@@ -3165,6 +3180,9 @@ static void SetRenderTargetTest(void)
hr = IDirect3DDevice7_GetRenderTarget(lpD3DDevice, &oldrt);
ok(hr == DD_OK, "IDirect3DDevice7_GetRenderTarget failed, hr=0x%08x\n", hr);
hr = IDirect3DDevice7_SetRenderTarget(lpD3DDevice, failrt, 0);
todo_wine ok(hr != D3D_OK, "IDirect3DDevice7_SetRenderTarget succeeded\n");
hr = IDirect3DDevice7_SetRenderTarget(lpD3DDevice, newrt, 0);
ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderTarget failed, hr=0x%08x\n", hr);
memset(&vp, 0xff, sizeof(vp));
......@@ -3231,6 +3249,7 @@ static void SetRenderTargetTest(void)
IDirectDrawSurface7_Release(oldrt);
IDirectDrawSurface7_Release(newrt);
IDirectDrawSurface7_Release(failrt);
}
static UINT expect_message;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment