Module: wine Branch: master Commit: 876f7546ab5d513804a163bd1805c9b64932eaf4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=876f7546ab5d513804a163bd18...
Author: Stefan Dösinger stefan@codeweavers.com Date: Mon Nov 23 13:21:35 2015 +0100
d3d8/tests: Multisampled render targets are zeroed on creation.
Signed-off-by: Stefan Dösinger stefan@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3d8/tests/visual.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 7029551..e3f6d2d 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -8503,6 +8503,75 @@ static void test_shademode(void) DestroyWindow(window); }
+static void test_multisample_init(void) +{ + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + IDirect3DSurface8 *back, *multi; + ULONG refcount; + HWND window; + HRESULT hr; + D3DCOLOR color; + unsigned int x, y; + struct surface_readback rb; + BOOL all_zero = TRUE; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + + if (FAILED(IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES))) + { + skip("Multisampling not supported for D3DFMT_A8R8G8B8, skipping multisample init test.\n"); + goto done; + } + + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice8_GetBackBuffer(device, 0, D3DBACKBUFFER_TYPE_MONO, &back); + ok(SUCCEEDED(hr), "Failed to get back buffer, hr %#x.\n", hr); + hr = IDirect3DDevice8_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8, + D3DMULTISAMPLE_2_SAMPLES, FALSE, &multi); + ok(SUCCEEDED(hr), "Failed to create multisampled render target, hr %#x.\n", hr); + + hr = IDirect3DDevice8_CopyRects(device, multi, NULL, 0, back, NULL); + ok(SUCCEEDED(hr), "CopyRects failed, hr %#x.\n", hr); + + get_rt_readback(back, &rb); + for (y = 0; y < 480; ++y) + { + for (x = 0; x < 640; ++x) + { + color = get_readback_color(&rb, x, y); + if (!color_match(color, 0x00000000, 0)) + { + all_zero = FALSE; + break; + } + } + if (!all_zero) + break; + } + release_surface_readback(&rb); + ok(all_zero, "Got unexpected color 0x%08x, position %ux%u.\n", color, x, y); + + IDirect3DSurface8_Release(multi); + IDirect3DSurface8_Release(back); + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + +done: + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER8 identifier; @@ -8567,4 +8636,5 @@ START_TEST(visual) test_flip(); test_uninitialized_varyings(); test_shademode(); + test_multisample_init(); }