Commit f26a58a6 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3dcompiler/tests: Add a test for struct field semantics.

parent 2ec86fc2
...@@ -900,6 +900,54 @@ static void test_struct_assignment(void) ...@@ -900,6 +900,54 @@ static void test_struct_assignment(void)
release_test_context(&test_context); release_test_context(&test_context);
} }
static void test_struct_semantics(void)
{
struct test_context test_context;
ID3D10Blob *ps_code = NULL;
struct vec4 v;
static const char ps_source[] =
"struct input\n"
"{\n"
" struct\n"
" {\n"
" float4 texcoord : TEXCOORD0;\n"
" } m;\n"
"};\n"
"struct output\n"
"{\n"
" struct\n"
" {\n"
" float4 color : COLOR;\n"
" } m;\n"
"};\n"
"struct output main(struct input i)\n"
"{\n"
" struct output o;\n"
" o.m.color = i.m.texcoord;\n"
" return o;\n"
"}";
if (!init_test_context(&test_context))
return;
todo_wine ps_code = compile_shader(ps_source, "ps_2_0");
if (ps_code)
{
draw_quad(test_context.device, ps_code);
v = get_color_vec4(test_context.device, 64, 48);
todo_wine ok(compare_vec4(&v, 0.1f, 0.1f, 0.0f, 0.0f, 4096),
"Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
v = get_color_vec4(test_context.device, 320, 240);
todo_wine ok(compare_vec4(&v, 0.5f, 0.5f, 0.0f, 0.0f, 4096),
"Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
ID3D10Blob_Release(ps_code);
}
release_test_context(&test_context);
}
static void check_constant_desc(const char *prefix, const D3DXCONSTANT_DESC *desc, static void check_constant_desc(const char *prefix, const D3DXCONSTANT_DESC *desc,
const D3DXCONSTANT_DESC *expect, BOOL nonzero_defaultvalue) const D3DXCONSTANT_DESC *expect, BOOL nonzero_defaultvalue)
{ {
...@@ -1208,6 +1256,7 @@ START_TEST(hlsl_d3d9) ...@@ -1208,6 +1256,7 @@ START_TEST(hlsl_d3d9)
test_array_dimensions(); test_array_dimensions();
test_majority(); test_majority();
test_struct_assignment(); test_struct_assignment();
test_struct_semantics();
test_constant_table(); test_constant_table();
test_fail(); test_fail();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment