[v2 3/3] d3d10core/tests: Add test for return in a conditional.
Andrew Wesie
awesie at gmail.com
Thu Nov 17 23:46:02 CST 2016
The test from d3d11 ported to d3d10core API.
Signed-off-by: Andrew Wesie <awesie at gmail.com>
---
dlls/d3d10core/tests/device.c | 83 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 83 insertions(+)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index 1952a87..8433412 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -9602,6 +9602,88 @@ float4 main(struct ps_data ps_input) : SV_Target
release_test_context(&test_context);
}
+static void test_sm4_ret_instruction(void)
+{
+ struct d3d10core_test_context test_context;
+ ID3D10PixelShader *ps;
+ ID3D10Device *device;
+ struct uvec4 constant;
+ ID3D10Buffer *cb;
+ HRESULT hr;
+
+ static const DWORD ps_code[] =
+ {
+#if 0
+ uint c;
+
+ float4 main() : SV_TARGET
+ {
+ if (c == 1)
+ return float4(1, 0, 0, 1);
+ if (c == 2)
+ return float4(0, 1, 0, 1);
+ if (c == 3)
+ return float4(0, 0, 1, 1);
+ return float4(1, 1, 1, 1);
+ }
+#endif
+ 0x43425844, 0x9ee6f808, 0xe74009f3, 0xbb1adaf2, 0x432e97b5, 0x00000001, 0x000001c4, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x0000014c, 0x00000040, 0x00000053,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
+ 0x00000001, 0x08000020, 0x00100012, 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x00004001,
+ 0x00000001, 0x0304001f, 0x0010000a, 0x00000000, 0x08000036, 0x001020f2, 0x00000000, 0x00004002,
+ 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x0100003e, 0x01000015, 0x08000020, 0x00100012,
+ 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x00004001, 0x00000002, 0x0304001f, 0x0010000a,
+ 0x00000000, 0x08000036, 0x001020f2, 0x00000000, 0x00004002, 0x00000000, 0x3f800000, 0x00000000,
+ 0x3f800000, 0x0100003e, 0x01000015, 0x08000020, 0x00100012, 0x00000000, 0x0020800a, 0x00000000,
+ 0x00000000, 0x00004001, 0x00000003, 0x0304001f, 0x0010000a, 0x00000000, 0x08000036, 0x001020f2,
+ 0x00000000, 0x00004002, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x0100003e, 0x01000015,
+ 0x08000036, 0x001020f2, 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
+ 0x0100003e,
+ };
+
+ if (!init_test_context(&test_context))
+ return;
+
+ device = test_context.device;
+
+ hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps);
+ ok(SUCCEEDED(hr), "Failed to create shader, hr %#x.\n", hr);
+ ID3D10Device_PSSetShader(device, ps);
+ memset(&constant, 0, sizeof(constant));
+ cb = create_buffer(device, D3D10_BIND_CONSTANT_BUFFER, sizeof(constant), &constant);
+ ID3D10Device_PSSetConstantBuffers(device, 0, 1, &cb);
+
+ draw_quad(&test_context);
+ check_texture_color(test_context.backbuffer, 0xffffffff, 0);
+
+ constant.x = 1;
+ ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)cb, 0, NULL, &constant, 0, 0);
+ draw_quad(&test_context);
+ check_texture_color(test_context.backbuffer, 0xff0000ff, 0);
+
+ constant.x = 2;
+ ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)cb, 0, NULL, &constant, 0, 0);
+ draw_quad(&test_context);
+ check_texture_color(test_context.backbuffer, 0xff00ff00, 0);
+
+ constant.x = 3;
+ ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)cb, 0, NULL, &constant, 0, 0);
+ draw_quad(&test_context);
+ check_texture_color(test_context.backbuffer, 0xffff0000, 0);
+
+ constant.x = 4;
+ ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)cb, 0, NULL, &constant, 0, 0);
+ draw_quad(&test_context);
+ check_texture_color(test_context.backbuffer, 0xffffffff, 0);
+
+ ID3D10Buffer_Release(cb);
+ ID3D10PixelShader_Release(ps);
+ release_test_context(&test_context);
+}
+
START_TEST(device)
{
test_feature_level();
@@ -9655,4 +9737,5 @@ START_TEST(device)
test_line_antialiasing_blending();
test_required_format_support();
test_ddy();
+ test_sm4_ret_instruction();
}
--
2.7.4
More information about the wine-patches
mailing list