d3d8/tests: Add more INTZ tests.
This commit is contained in:
parent
5eecdc80e1
commit
5604c7ed99
@ -1854,6 +1854,20 @@ static void intz_test(IDirect3DDevice8 *device)
|
|||||||
{ 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.5f},
|
{ 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.5f},
|
||||||
{ -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f},
|
{ -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f},
|
||||||
{ 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.5f},
|
{ 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.5f},
|
||||||
|
},
|
||||||
|
half_quad_1[] =
|
||||||
|
{
|
||||||
|
{ -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.5f},
|
||||||
|
{ 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.5f},
|
||||||
|
{ -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f},
|
||||||
|
{ 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.5f},
|
||||||
|
},
|
||||||
|
half_quad_2[] =
|
||||||
|
{
|
||||||
|
{ -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.5f},
|
||||||
|
{ 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.5f},
|
||||||
|
{ -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f},
|
||||||
|
{ 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.5f},
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -1888,6 +1902,11 @@ static void intz_test(IDirect3DDevice8 *device)
|
|||||||
skip("No pixel shader 1.1 support, skipping INTZ test.\n");
|
skip("No pixel shader 1.1 support, skipping INTZ test.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (caps.TextureCaps & D3DPTEXTURECAPS_POW2)
|
||||||
|
{
|
||||||
|
skip("No unconditional NP2 texture support, skipping INTZ test.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hr = IDirect3DDevice8_GetDirect3D(device, &d3d8);
|
hr = IDirect3DDevice8_GetDirect3D(device, &d3d8);
|
||||||
ok(SUCCEEDED(hr), "GetDirect3D failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "GetDirect3D failed, hr %#x.\n", hr);
|
||||||
@ -1907,10 +1926,10 @@ static void intz_test(IDirect3DDevice8 *device)
|
|||||||
hr = IDirect3DDevice8_GetDepthStencilSurface(device, &original_ds);
|
hr = IDirect3DDevice8_GetDepthStencilSurface(device, &original_ds);
|
||||||
ok(SUCCEEDED(hr), "GetDepthStencilSurface failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "GetDepthStencilSurface failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice8_CreateTexture(device, 1024, 1024, 1,
|
hr = IDirect3DDevice8_CreateTexture(device, 640, 480, 1,
|
||||||
D3DUSAGE_DEPTHSTENCIL, MAKEFOURCC('I','N','T','Z'), D3DPOOL_DEFAULT, &texture);
|
D3DUSAGE_DEPTHSTENCIL, MAKEFOURCC('I','N','T','Z'), D3DPOOL_DEFAULT, &texture);
|
||||||
ok(SUCCEEDED(hr), "CreateTexture failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "CreateTexture failed, hr %#x.\n", hr);
|
||||||
hr = IDirect3DDevice8_CreateRenderTarget(device, 1024, 1024, D3DFMT_A8R8G8B8,
|
hr = IDirect3DDevice8_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8,
|
||||||
D3DMULTISAMPLE_NONE, FALSE, &rt);
|
D3DMULTISAMPLE_NONE, FALSE, &rt);
|
||||||
ok(SUCCEEDED(hr), "CreateRenderTarget failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "CreateRenderTarget failed, hr %#x.\n", hr);
|
||||||
hr = IDirect3DDevice8_CreatePixelShader(device, ps_code, &ps);
|
hr = IDirect3DDevice8_CreatePixelShader(device, ps_code, &ps);
|
||||||
@ -1953,6 +1972,8 @@ static void intz_test(IDirect3DDevice8 *device)
|
|||||||
|
|
||||||
hr = IDirect3DTexture8_GetSurfaceLevel(texture, 0, &ds);
|
hr = IDirect3DTexture8_GetSurfaceLevel(texture, 0, &ds);
|
||||||
ok(SUCCEEDED(hr), "GetSurfaceLevel failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "GetSurfaceLevel failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
/* Render offscreen, using the INTZ texture as depth buffer */
|
||||||
hr = IDirect3DDevice8_SetRenderTarget(device, rt, ds);
|
hr = IDirect3DDevice8_SetRenderTarget(device, rt, ds);
|
||||||
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
||||||
IDirect3DDevice8_SetPixelShader(device, 0);
|
IDirect3DDevice8_SetPixelShader(device, 0);
|
||||||
@ -1998,6 +2019,128 @@ static void intz_test(IDirect3DDevice8 *device)
|
|||||||
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
|
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
|
||||||
ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_SetTexture(device, 0, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_SetTexture(device, 1, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);
|
||||||
|
IDirect3DTexture8_Release(texture);
|
||||||
|
|
||||||
|
/* Render onscreen while using the INTZ texture as depth buffer */
|
||||||
|
hr = IDirect3DDevice8_CreateTexture(device, 640, 480, 1,
|
||||||
|
D3DUSAGE_DEPTHSTENCIL, MAKEFOURCC('I','N','T','Z'), D3DPOOL_DEFAULT, &texture);
|
||||||
|
ok(SUCCEEDED(hr), "CreateTexture failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DTexture8_GetSurfaceLevel(texture, 0, &ds);
|
||||||
|
ok(SUCCEEDED(hr), "GetSurfaceLevel failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_SetRenderTarget(device, original_rt, ds);
|
||||||
|
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
||||||
|
IDirect3DDevice8_SetPixelShader(device, 0);
|
||||||
|
ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_ZBUFFER, 0, 0.0f, 0);
|
||||||
|
ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_BeginScene(device);
|
||||||
|
ok(SUCCEEDED(hr), "BeginScene failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));
|
||||||
|
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_EndScene(device);
|
||||||
|
ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_SetRenderTarget(device, original_rt, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
||||||
|
IDirect3DSurface8_Release(ds);
|
||||||
|
hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)texture);
|
||||||
|
ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_SetTexture(device, 1, (IDirect3DBaseTexture8 *)texture);
|
||||||
|
ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_SetPixelShader(device, ps);
|
||||||
|
ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
/* Read the depth values back. */
|
||||||
|
hr = IDirect3DDevice8_BeginScene(device);
|
||||||
|
ok(SUCCEEDED(hr), "BeginScene failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));
|
||||||
|
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_EndScene(device);
|
||||||
|
ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(expected_colors) / sizeof(*expected_colors); ++i)
|
||||||
|
{
|
||||||
|
D3DCOLOR color = getPixelColor(device, expected_colors[i].x, expected_colors[i].y);
|
||||||
|
ok(color_match(color, expected_colors[i].color, 1),
|
||||||
|
"Expected color 0x%08x at (%u, %u), got 0x%08x.\n",
|
||||||
|
expected_colors[i].color, expected_colors[i].x, expected_colors[i].y, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_SetTexture(device, 0, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_SetTexture(device, 1, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);
|
||||||
|
IDirect3DTexture8_Release(texture);
|
||||||
|
|
||||||
|
/* Render offscreen, then onscreen, and finally check the INTZ texture in both areas */
|
||||||
|
hr = IDirect3DDevice8_CreateTexture(device, 640, 480, 1,
|
||||||
|
D3DUSAGE_DEPTHSTENCIL, MAKEFOURCC('I','N','T','Z'), D3DPOOL_DEFAULT, &texture);
|
||||||
|
ok(SUCCEEDED(hr), "CreateTexture failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DTexture8_GetSurfaceLevel(texture, 0, &ds);
|
||||||
|
ok(SUCCEEDED(hr), "GetSurfaceLevel failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_SetRenderTarget(device, rt, ds);
|
||||||
|
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
||||||
|
IDirect3DDevice8_SetPixelShader(device, 0);
|
||||||
|
ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_ZBUFFER, 0, 0.0f, 0);
|
||||||
|
ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_BeginScene(device);
|
||||||
|
ok(SUCCEEDED(hr), "BeginScene failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, half_quad_1, sizeof(*half_quad_1));
|
||||||
|
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_EndScene(device);
|
||||||
|
ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_SetRenderTarget(device, original_rt, ds);
|
||||||
|
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_BeginScene(device);
|
||||||
|
ok(SUCCEEDED(hr), "BeginScene failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, half_quad_2, sizeof(*half_quad_2));
|
||||||
|
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_EndScene(device);
|
||||||
|
ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_SetRenderTarget(device, original_rt, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
||||||
|
IDirect3DSurface8_Release(ds);
|
||||||
|
hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)texture);
|
||||||
|
ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_SetTexture(device, 1, (IDirect3DBaseTexture8 *)texture);
|
||||||
|
ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_SetPixelShader(device, ps);
|
||||||
|
ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
/* Read the depth values back. */
|
||||||
|
hr = IDirect3DDevice8_BeginScene(device);
|
||||||
|
ok(SUCCEEDED(hr), "BeginScene failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));
|
||||||
|
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_EndScene(device);
|
||||||
|
ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(expected_colors) / sizeof(*expected_colors); ++i)
|
||||||
|
{
|
||||||
|
D3DCOLOR color = getPixelColor(device, expected_colors[i].x, expected_colors[i].y);
|
||||||
|
ok(color_match(color, expected_colors[i].color, 1),
|
||||||
|
"Expected color 0x%08x at (%u, %u), got 0x%08x.\n",
|
||||||
|
expected_colors[i].color, expected_colors[i].x, expected_colors[i].y, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice8_SetRenderTarget(device, original_rt, original_ds);
|
hr = IDirect3DDevice8_SetRenderTarget(device, original_rt, original_ds);
|
||||||
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
||||||
IDirect3DSurface8_Release(original_ds);
|
IDirect3DSurface8_Release(original_ds);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user