Signed-off-by: Jan Sikorski <jsikorski(a)codeweavers.com>
---
dlls/d3d11/tests/d3d11.c | 398 +++++++++++++++++++++++++++++++++++++++
1 file changed, 398 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 1505b3fddbc..aa500634fe1 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -30025,6 +30025,403 @@ done:
release_test_context(&test_context);
}
+struct resolve_test_context
+{
+ ID3D11Device *device;
+ ID3D11DeviceContext *device_context;
+ ID3D11VertexShader *vertex_shader;
+ ID3D11InputLayout *input_layout;
+ ID3D11Buffer *vertex_buffer;
+};
+
+static void run_test_multisample_resolve(struct resolve_test_context *context,
+ ID3D11PixelShader *pixel_shader, DXGI_FORMAT render_target_view_format,
+ DXGI_FORMAT source_format, DXGI_FORMAT destination_format, DXGI_FORMAT resolve_format,
+ unsigned byte_count, void *bytes_out)
+{
+ ID3D11Texture2D *staging_texture, *resolve_target, *render_target;
+ D3D11_VIEWPORT viewport = { 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f };
+ D3D11_RENDER_TARGET_VIEW_DESC render_view_desc = {};
+ unsigned vertex_buffer_stride = 6 * sizeof(float);
+ float clear_color[4] = {0.2f, 0.2f, 0.2f, 1.0f};
+ D3D11_MAPPED_SUBRESOURCE staging_mapped = {};
+ ID3D11RenderTargetView *render_target_view;
+ D3D11_TEXTURE2D_DESC staging_desc = {};
+ D3D11_TEXTURE2D_DESC resolve_desc = {};
+ D3D11_TEXTURE2D_DESC render_desc = {};
+ unsigned vertex_buffer_offset = 0;
+ unsigned vertex_count = 3;
+ HRESULT hr;
+
+ staging_desc.Width = 1;
+ staging_desc.Height = 1;
+ staging_desc.MipLevels = 1;
+ staging_desc.ArraySize = 1;
+ staging_desc.Format = resolve_format;
+ staging_desc.SampleDesc.Count = 1;
+ staging_desc.SampleDesc.Quality = 0;
+ staging_desc.Usage = D3D11_USAGE_STAGING;
+ staging_desc.BindFlags = 0;
+ staging_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
+ staging_desc.MiscFlags = 0;
+
+ render_desc.Width = 1;
+ render_desc.Height = 1;
+ render_desc.MipLevels = 1;
+ render_desc.ArraySize = 1;
+ render_desc.Format = source_format;
+ render_desc.SampleDesc.Count = 2;
+ render_desc.SampleDesc.Quality = 0;
+ render_desc.Usage = D3D11_USAGE_DEFAULT;
+ render_desc.BindFlags = D3D11_BIND_RENDER_TARGET;
+ render_desc.CPUAccessFlags = 0;
+ render_desc.MiscFlags = 0;
+
+ render_view_desc.Format = render_target_view_format;
+ render_view_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
+
+ resolve_desc.Width = 1;
+ resolve_desc.Height = 1;
+ resolve_desc.MipLevels = 1;
+ resolve_desc.ArraySize = 1;
+ resolve_desc.Format = destination_format;
+ resolve_desc.SampleDesc.Count = 1;
+ resolve_desc.SampleDesc.Quality = 0;
+ resolve_desc.Usage = D3D11_USAGE_DEFAULT;
+ resolve_desc.BindFlags = 0;
+ resolve_desc.CPUAccessFlags = 0;
+ resolve_desc.MiscFlags = 0;
+
+ memset(bytes_out, 0, byte_count);
+
+ hr = ID3D11Device_CreateTexture2D(context->device, &staging_desc, NULL, &staging_texture);
+ if (FAILED(hr))
+ {
+ trace("Failed to create staging texture, hr %#x.\n", hr);
+ return;
+ }
+
+ hr = ID3D11Device_CreateTexture2D(context->device, &render_desc, NULL, &render_target);
+ if (FAILED(hr))
+ {
+ trace("Failed to create render target texture, hr %#x.\n", hr);
+ return;
+ }
+
+ hr = ID3D11Device_CreateRenderTargetView(context->device, (ID3D11Resource *)render_target,
+ &render_view_desc, &render_target_view);
+ if (FAILED(hr))
+ {
+ trace("Failed to create render target view, hr %#x.\n", hr);
+ return;
+ }
+
+ hr = ID3D11Device_CreateTexture2D(context->device, &resolve_desc, NULL, &resolve_target);
+ if (FAILED(hr))
+ {
+ trace("Failed to create resolve texture, hr %#x.\n", hr);
+ return;
+ }
+
+ ID3D11DeviceContext_RSSetViewports(context->device_context, 1, &viewport);
+ ID3D11DeviceContext_OMSetRenderTargets(context->device_context, 1, &render_target_view, NULL);
+ ID3D11DeviceContext_IASetPrimitiveTopology(context->device_context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+ ID3D11DeviceContext_IASetInputLayout(context->device_context, context->input_layout);
+ ID3D11DeviceContext_VSSetShader(context->device_context, context->vertex_shader, NULL, 0);
+ ID3D11DeviceContext_PSSetShader(context->device_context, pixel_shader, NULL, 0);
+ ID3D11DeviceContext_IASetVertexBuffers(context->device_context, 0, 1, &context->vertex_buffer,
+ &vertex_buffer_stride, &vertex_buffer_offset);
+ ID3D11DeviceContext_ClearRenderTargetView(context->device_context, render_target_view, clear_color);
+ ID3D11DeviceContext_Draw(context->device_context, vertex_count, 0);
+ ID3D11DeviceContext_ResolveSubresource(context->device_context, (ID3D11Resource *)resolve_target,
+ 0, (ID3D11Resource *)render_target, 0, resolve_format);
+ ID3D11DeviceContext_CopyResource(context->device_context, (ID3D11Resource *)staging_texture,
+ (ID3D11Resource *)resolve_target);
+ ID3D11DeviceContext_Map(context->device_context, (ID3D11Resource *)staging_texture, 0,
+ D3D11_MAP_READ, 0, &staging_mapped);
+ memcpy(bytes_out, staging_mapped.pData, byte_count);
+ ID3D11DeviceContext_Unmap(context->device_context, (ID3D11Resource *)staging_texture, 0);
+ ID3D11RenderTargetView_Release(render_target_view);
+ ID3D11Texture2D_Release(render_target);
+ ID3D11Texture2D_Release(resolve_target);
+ ID3D11Texture2D_Release(staging_texture);
+}
+
+static void test_multisample_resolve2(void)
+{
+ D3D_FEATURE_LEVEL feature_levels[] = { D3D_FEATURE_LEVEL_11_0 };
+ UINT device_creation_flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
+ ID3D11PixelShader *pixel_shader, *pixel_shader_uint;
+ struct resolve_test_context context;
+ unsigned int i, quality_levels;
+ unsigned char result[4];
+ HRESULT hr;
+
+ const BYTE vs_code[] =
+ {
+#if 0
+ struct VS_Input
+ {
+ float2 pos : POS;
+ float4 color : COL;
+ };
+
+ struct VS_Output
+ {
+ float4 position : SV_POSITION;
+ float4 color : COL;
+ };
+
+ VS_Output vs_main(VS_Input input)
+ {
+ VS_Output output;
+ output.position = float4(input.pos, 0.0f, 1.0f);
+ output.color = input.color;
+
+ return output;
+ }
+#endif
+ 68,88,66,67,30,184,39,220,81,141,142,55,98,251,192,170,226,59,
+ 159,54,1,0,0,0,104,2,0,0,5,0,0,0,52,0,0,0,160,0,0,0,232,0,0,0,
+ 56,1,0,0,204,1,0,0,82,68,69,70,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 60,0,0,0,0,5,254,255,0,1,0,0,60,0,0,0,82,68,49,49,60,0,0,0,24,0,
+ 0,0,32,0,0,0,40,0,0,0,36,0,0,0,12,0,0,0,0,0,0,0,77,105,99,114,111,
+ 115,111,102,116,32,40,82,41,32,72,76,83,76,32,83,104,97,100,101,
+ 114,32,67,111,109,112,105,108,101,114,32,49,48,46,49,0,73,83,71,
+ 78,64,0,0,0,2,0,0,0,8,0,0,0,56,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,
+ 0,0,3,3,0,0,60,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,15,15,0,0,
+ 80,79,83,0,67,79,76,0,79,83,71,78,72,0,0,0,2,0,0,0,8,0,0,0,56,0,
+ 0,0,0,0,0,0,1,0,0,0,3,0,0,0,0,0,0,0,15,0,0,0,68,0,0,0,0,0,0,0,0,
+ 0,0,0,3,0,0,0,1,0,0,0,15,0,0,0,83,86,95,80,79,83,73,84,73,79,78,
+ 0,67,79,76,0,83,72,69,88,140,0,0,0,80,0,1,0,35,0,0,0,106,8,0,1,
+ 95,0,0,3,50,16,16,0,0,0,0,0,95,0,0,3,242,16,16,0,1,0,0,0,103,0,0,
+ 4,242,32,16,0,0,0,0,0,1,0,0,0,101,0,0,3,242,32,16,0,1,0,0,0,54,
+ 0,0,5,50,32,16,0,0,0,0,0,70,16,16,0,0,0,0,0,54,0,0,8,194,32,16,0,
+ 0,0,0,0,2,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,63,54,0,0,5,242,
+ 32,16,0,1,0,0,0,70,30,16,0,1,0,0,0,62,0,0,1,83,84,65,84,148,0,0,0,
+ 4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ };
+
+ const BYTE ps_code[] =
+ {
+#if 0
+ float4 ps_main(VS_Output input) : SV_TARGET
+ {
+ return input.color;
+ }
+#endif
+ 68,88,66,67,39,85,23,171,129,58,200,222,67,215,85,143,48,99,104,37,
+ 1,0,0,0,4,2,0,0,5,0,0,0,52,0,0,0,160,0,0,0,240,0,0,0,36,1,0,0,104,
+ 1,0,0,82,68,69,70,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,0,0,0,0,5,
+ 255,255,0,1,0,0,60,0,0,0,82,68,49,49,60,0,0,0,24,0,0,0,32,0,0,0,40,
+ 0,0,0,36,0,0,0,12,0,0,0,0,0,0,0,77,105,99,114,111,115,111,102,116,
+ 32,40,82,41,32,72,76,83,76,32,83,104,97,100,101,114,32,67,111,109,
+ 112,105,108,101,114,32,49,48,46,49,0,73,83,71,78,72,0,0,0,2,0,0,0,8,
+ 0,0,0,56,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,0,0,0,0,15,0,0,0,68,0,0,0,0,
+ 0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,15,15,0,0,83,86,95,80,79,83,73,84,73,
+ 79,78,0,67,79,76,0,79,83,71,78,44,0,0,0,1,0,0,0,8,0,0,0,32,0,0,0,0,
+ 0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,15,0,0,0,83,86,95,84,65,82,71,69,84,0,
+ 171,171,83,72,69,88,60,0,0,0,80,0,0,0,15,0,0,0,106,8,0,1,98,16,0,3,
+ 242,16,16,0,1,0,0,0,101,0,0,3,242,32,16,0,0,0,0,0,54,0,0,5,242,32,
+ 16,0,0,0,0,0,70,30,16,0,1,0,0,0,62,0,0,1,83,84,65,84,148,0,0,0,2,0,
+ 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0
+ };
+
+ const BYTE ps_uint_code[] =
+ {
+#if 0
+ uint4 ps_main_uint(VS_Output input) : SV_TARGET
+ {
+ return 255 * input.color;
+ }
+#endif
+ 68,88,66,67,183,183,169,55,133,61,81,26,195,69,141,254,78,169,90,79,
+ 1,0,0,0,52,2,0,0,5,0,0,0,52,0,0,0,160,0,0,0,240,0,0,0,36,1,0,0,152,
+ 1,0,0,82,68,69,70,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,0,0,0,0,5,255,
+ 255,0,1,0,0,60,0,0,0,82,68,49,49,60,0,0,0,24,0,0,0,32,0,0,0,40,0,0,0,
+ 36,0,0,0,12,0,0,0,0,0,0,0,77,105,99,114,111,115,111,102,116,32,40,82,
+ 41,32,72,76,83,76,32,83,104,97,100,101,114,32,67,111,109,112,105,108,
+ 101,114,32,49,48,46,49,0,73,83,71,78,72,0,0,0,2,0,0,0,8,0,0,0,56,0,0,0,
+ 0,0,0,0,1,0,0,0,3,0,0,0,0,0,0,0,15,0,0,0,68,0,0,0,0,0,0,0,0,0,0,0,3,
+ 0,0,0,1,0,0,0,15,15,0,0,83,86,95,80,79,83,73,84,73,79,78,0,67,79,76,0,
+ 79,83,71,78,44,0,0,0,1,0,0,0,8,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
+ 0,0,0,0,15,0,0,0,83,86,95,84,65,82,71,69,84,0,171,171,83,72,69,88,108,
+ 0,0,0,80,0,0,0,27,0,0,0,106,8,0,1,98,16,0,3,242,16,16,0,1,0,0,0,101,0,
+ 0,3,242,32,16,0,0,0,0,0,104,0,0,2,1,0,0,0,56,0,0,10,242,0,16,0,0,0,0,
+ 0,70,30,16,0,1,0,0,0,2,64,0,0,0,0,127,67,0,0,127,67,0,0,127,67,0,0,127,
+ 67,28,0,0,5,242,32,16,0,0,0,0,0,70,14,16,0,0,0,0,0,62,0,0,1,83,84,65,
+ 84,148,0,0,0,3,0,0,0,1,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,
+ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ };
+
+ float vertex_data [] =
+ { /* x, y, r, g, b, a */
+ 1.0f, 1.0f, .8f, 0.f, 0.f, 1.f,
+ 1.0f, -1.0f, .8f, 0.f, 0.f, 1.f,
+ -1.0f, -1.0f, .8f, 0.f, 0.f, 1.f,
+ };
+
+ D3D11_INPUT_ELEMENT_DESC input_elements[] =
+ {
+ { "POS", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "COL", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }
+ };
+
+ struct
+ {
+ BOOL use_uint_shader;
+ DXGI_FORMAT render_target_view_format;
+ DXGI_FORMAT source_format;
+ DXGI_FORMAT destination_format;
+ DXGI_FORMAT resolve_format;
+ unsigned int byte_count;
+ unsigned char expected[4];
+ BOOL todo;
+ }
+ tests[] =
+ {
+ { FALSE, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT,
+ 4, { 0, 0, 0, 0x3f } },
+ { FALSE, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_TYPELESS,
+ DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT,
+ 4, { 0, 0, 0, 0x3f }, TRUE },
+ { FALSE, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT,
+ 4, { 0, 0, 0, 0x3f }, TRUE },
+ { FALSE, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_TYPELESS,
+ DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT,
+ 4, { 0, 0, 0, 0x3f }, TRUE },
+ { FALSE, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM,
+ 2, { 0, 0x80 } },
+ { FALSE, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT,
+ DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT,
+ 2, { 0xff, 0x37 } },
+ { FALSE, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_TYPELESS,
+ DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_FLOAT,
+ 2, { 0xff, 0x37 } },
+ { FALSE, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_TYPELESS,
+ DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM,
+ 2, { 0x66, 0x36 }, TRUE },
+ { FALSE, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_TYPELESS,
+ DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_FLOAT,
+ 2, { 0xbd, 0xc8 } },
+ { FALSE, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM,
+ 4, { 0x80, 0x19, 0x19, 0xff } },
+ { FALSE, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_TYPELESS,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ 4, { 0x99, 0x23, 0x23, 0xff }, TRUE },
+ { FALSE, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_TYPELESS,
+ DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ 4, { 0x99, 0x23, 0x23, 0xff }, TRUE },
+ { FALSE, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_TYPELESS,
+ DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_SNORM,
+ 4, { 0, 0x19, 0x19, 0xff }, TRUE },
+ { FALSE, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_TYPELESS,
+ DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_UNORM,
+ 4, { 0x3f, 0xc, 0xc, 0x7f }, TRUE },
+ { TRUE, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_TYPELESS,
+ DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_UNORM,
+ 4, { 0x3f, 0, 0, 0x40 }, TRUE },
+ { TRUE, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_TYPELESS,
+ DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_SNORM,
+ 4, { 0x40, 0, 0, 0x40 }, TRUE },
+ { TRUE, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_TYPELESS,
+ DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_UNORM,
+ 4, { 0x66, 0, 0, 0x80 }, TRUE },
+ };
+
+ hr = D3D11CreateDevice(0, D3D_DRIVER_TYPE_HARDWARE, 0, device_creation_flags,
+ feature_levels, ARRAY_SIZE(feature_levels), D3D11_SDK_VERSION, &context.device,
+ 0, &context.device_context);
+ if (FAILED(hr))
+ {
+ trace("Failed to create device, hr %#x.\n", hr);
+ return;
+ }
+
+ hr = ID3D11Device_CreateVertexShader(context.device, vs_code, sizeof(vs_code),
+ NULL, &context.vertex_shader);
+ if (FAILED(hr))
+ {
+ trace("Failed to create vertex shader, hr %#x.\n", hr);
+ goto out_1;
+ }
+ hr = ID3D11Device_CreatePixelShader(context.device, ps_code, sizeof(ps_code),
+ NULL, &pixel_shader);
+ if (FAILED(hr))
+ {
+ trace("Failed to create pixel shader, hr %#x.\n", hr);
+ goto out_2;
+ }
+ hr = ID3D11Device_CreatePixelShader(context.device, ps_uint_code, sizeof(ps_uint_code),
+ NULL, &pixel_shader_uint);
+ if (FAILED(hr))
+ {
+ trace("Failed to create uint pixel shader, hr %#x.\n", hr);
+ goto out_3;
+ }
+ hr = ID3D11Device_CreateInputLayout(context.device, input_elements,
+ ARRAY_SIZE(input_elements), vs_code, sizeof(vs_code), &context.input_layout);
+ if (FAILED(hr))
+ {
+ trace("Failed to create input layout, hr %#x.\n", hr);
+ goto out_4;
+ }
+ context.vertex_buffer = create_buffer(context.device, D3D11_BIND_VERTEX_BUFFER,
+ sizeof(vertex_data), vertex_data);
+ if (!context.vertex_buffer)
+ goto out_5;
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = ID3D11Device_CheckMultisampleQualityLevels(context.device, tests[i].source_format, 2, &quality_levels);
+ ok(hr == S_OK, "Failed to check multisample quality levels, hr %#x.\n", hr);
+ if (!quality_levels)
+ {
+ skip("Test %3u: 2xMSAA not supported.\n", i);
+ }
+ else
+ {
+ run_test_multisample_resolve(&context, tests[i].use_uint_shader ? pixel_shader_uint : pixel_shader,
+ tests[i].render_target_view_format, tests[i].source_format, tests[i].destination_format,
+ tests[i].resolve_format, tests[i].byte_count, result);
+
+ todo_wine_if(tests[i].todo)
+ ok(!memcmp(result, tests[i].expected, tests[i].byte_count),
+ "Test %3u: expected: %2x %2x %2x %2x, got: %2x %2x %2x %2x\n", i,
+ tests[i].expected[0], tests[i].expected[1], tests[i].expected[2], tests[i].expected[3],
+ result[0], result[1], result[2], result[3]);
+ }
+ }
+
+ ID3D11Buffer_Release(context.vertex_buffer);
+out_5:
+ ID3D11InputLayout_Release(context.input_layout);
+out_4:
+ ID3D11PixelShader_Release(pixel_shader_uint);
+out_3:
+ ID3D11PixelShader_Release(pixel_shader);
+out_2:
+ ID3D11VertexShader_Release(context.vertex_shader);
+out_1:
+ ID3D11DeviceContext_Release(context.device_context);
+ ID3D11Device_Release(context.device);
+}
+
static void test_multisample_resolve(void)
{
struct d3d11_test_context test_context;
@@ -32194,6 +32591,7 @@ START_TEST(d3d11)
queue_test(test_unbound_multisample_texture);
queue_test(test_multiple_viewports);
queue_test(test_multisample_resolve);
+ queue_test(test_multisample_resolve2);
queue_test(test_sample_shading);
queue_test(test_sample_mask);
queue_test(test_depth_clip);
--
2.30.0