[PATCH 5/5] d3d8/tests: Multisampled render targets are zeroed on creation.
Stefan Dösinger
stefan at codeweavers.com
Sat Nov 21 18:01:01 CST 2015
Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
---
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..78f7e26 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", "d3d9_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();
}
--
2.4.10
More information about the wine-patches
mailing list