[PATCH 2/5] d3d11/tests: Multisampled render targets are zeroed on creation.
Stefan Dösinger
stefan at codeweavers.com
Tue Nov 24 15:18:43 CST 2015
Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
---
dlls/d3d11/tests/d3d11.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 7021c6f..3347c9d 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -4150,6 +4150,73 @@ done:
ok(!refcount, "Device has %u references left.\n", refcount);
}
+static void test_multisample_init(void)
+{
+ D3D11_TEXTURE2D_DESC desc;
+ ID3D11Texture2D *single, *multi;
+ ID3D11Device *device;
+ ID3D11DeviceContext *context;
+ ULONG refcount;
+ DWORD color;
+ HRESULT hr;
+ unsigned int x, y;
+ struct texture_readback rb;
+ BOOL all_zero = TRUE;
+
+ if (!(device = create_device(NULL)))
+ {
+ skip("Failed to create device, skipping tests.\n");
+ return;
+ }
+
+ ID3D11Device_GetImmediateContext(device, &context);
+
+ desc.Width = 640;
+ desc.Height = 480;
+ desc.MipLevels = 1;
+ desc.ArraySize = 1;
+ desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ desc.SampleDesc.Count = 2;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = D3D11_BIND_RENDER_TARGET;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+ hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &multi);
+ ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+
+ /* CopyResource from a multisampled to a sysmem texture works, but leaks memory on Windows
+ * (Nvidia, not checked on AMD). Use a single sampled buffer to work around. */
+ desc.SampleDesc.Count = 1;
+ hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &single);
+ ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ID3D11DeviceContext_CopyResource(context, (ID3D11Resource *)single, (ID3D11Resource *)multi);
+
+ get_texture_readback(single, &rb);
+ for (y = 0; y < 480; ++y)
+ {
+ for (x = 0; x < 640; ++x)
+ {
+ color = get_readback_color(&rb, x, y);
+ if (!compare_color(color, 0x00000000, 0))
+ {
+ all_zero = FALSE;
+ break;
+ }
+ }
+ if (!all_zero)
+ break;
+ }
+ release_texture_readback(&rb);
+ ok(all_zero, "Got unexpected color 0x%08x, position %ux%u.\n", color, x, y);
+
+ ID3D11DeviceContext_Release(context);
+ ID3D11Texture2D_Release(single);
+ ID3D11Texture2D_Release(multi);
+ refcount = ID3D11Device_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+}
+
START_TEST(d3d11)
{
test_create_device();
@@ -4179,4 +4246,5 @@ START_TEST(d3d11)
test_fragment_coords();
test_update_subresource();
test_resource_map();
+ test_multisample_init();
}
--
2.4.10
More information about the wine-patches
mailing list