d3d9/tests: Add a small test for multisampled GetRenderTargetData().

This commit is contained in:
Henri Verbeet 2011-10-19 22:03:12 +02:00 committed by Alexandre Julliard
parent fd1afd24f4
commit 12a99309d9
1 changed files with 51 additions and 0 deletions

View File

@ -12607,6 +12607,56 @@ static void update_surface_test(IDirect3DDevice9 *device)
IDirect3DTexture9_Release(src_tex);
}
static void multisample_get_rtdata_test(IDirect3DDevice9 *device)
{
IDirect3DSurface9 *original_ds, *original_rt, *rt, *readback;
IDirect3D9 *d3d9;
HRESULT hr;
hr = IDirect3DDevice9_GetDirect3D(device, &d3d9);
ok(SUCCEEDED(hr), "Failed to get d3d9 interface, hr %#x.\n", hr);
hr = IDirect3D9_CheckDeviceMultiSampleType(d3d9, D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL);
IDirect3D9_Release(d3d9);
if (FAILED(hr))
{
skip("Multisampling not supported for D3DFMT_A8R8G8B8, skipping multisampled CopyRects test.\n");
return;
}
hr = IDirect3DDevice9_CreateRenderTarget(device, 256, 256, D3DFMT_A8R8G8B8,
D3DMULTISAMPLE_2_SAMPLES, 0, FALSE, &rt, NULL);
ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 256, 256, D3DFMT_A8R8G8B8,
D3DPOOL_SYSTEMMEM, &readback, NULL);
ok(SUCCEEDED(hr), "Failed to create readback surface, hr %#x.\n", hr);
hr = IDirect3DDevice9_GetRenderTarget(device, 0, &original_rt);
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
hr = IDirect3DDevice9_GetDepthStencilSurface(device, &original_ds);
ok(SUCCEEDED(hr), "Failed to get depth/stencil, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetRenderTarget(device, 0, rt);
ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetDepthStencilSurface(device, NULL);
ok(SUCCEEDED(hr), "Failed to set depth/stencil, hr %#x.\n", hr);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff00ff00, 0.0, 0);
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
hr = IDirect3DDevice9_GetRenderTargetData(device, rt, readback);
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_SetDepthStencilSurface(device, original_ds);
ok(SUCCEEDED(hr), "Failed to set depth/stencil, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetRenderTarget(device, 0, original_rt);
ok(SUCCEEDED(hr), "Failed to restore original render target, hr %#x.\n", hr);
IDirect3DSurface9_Release(original_ds);
IDirect3DSurface9_Release(original_rt);
IDirect3DSurface9_Release(readback);
IDirect3DSurface9_Release(rt);
}
START_TEST(visual)
{
IDirect3DDevice9 *device_ptr;
@ -12781,6 +12831,7 @@ START_TEST(visual)
srgbwrite_format_test(device_ptr);
clip_planes_test(device_ptr);
update_surface_test(device_ptr);
multisample_get_rtdata_test(device_ptr);
cleanup:
if(device_ptr) {