d3dcompiler/tests: Add a test for struct field semantics.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2ec86fc20a
commit
f26a58a61b
|
@ -900,6 +900,54 @@ static void test_struct_assignment(void)
|
|||
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,
|
||||
const D3DXCONSTANT_DESC *expect, BOOL nonzero_defaultvalue)
|
||||
{
|
||||
|
@ -1208,6 +1256,7 @@ START_TEST(hlsl_d3d9)
|
|||
test_array_dimensions();
|
||||
test_majority();
|
||||
test_struct_assignment();
|
||||
test_struct_semantics();
|
||||
|
||||
test_constant_table();
|
||||
test_fail();
|
||||
|
|
Loading…
Reference in New Issue