diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 7e3a1257..47b26194 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -2384,7 +2384,7 @@ static void sm6_parser_init_signature(struct sm6_parser *sm6, const struct shade { struct vkd3d_shader_dst_param *param; const struct signature_element *e; - unsigned int i; + unsigned int i, count; for (i = 0; i < s->element_count; ++i) { @@ -2392,8 +2392,11 @@ static void sm6_parser_init_signature(struct sm6_parser *sm6, const struct shade param = ¶ms[i]; dst_param_io_init(param, e, reg_type); - param->reg.idx[0].offset = i; - param->reg.idx_count = 1; + count = 0; + if (e->register_count > 1) + param->reg.idx[count++].offset = 0; + param->reg.idx[count++].offset = i; + param->reg.idx_count = count; } } @@ -2427,6 +2430,12 @@ static void sm6_parser_emit_signature(struct sm6_parser *sm6, const struct shade ins->flags = e->interpolation_mode; *param = params[i]; + + if (e->register_count > 1) + { + param->reg.idx[0].rel_addr = NULL; + param->reg.idx[0].offset = e->register_count; + } } } diff --git a/tests/hlsl/entry-point-semantics.shader_test b/tests/hlsl/entry-point-semantics.shader_test index 6d355ab5..d177b037 100644 --- a/tests/hlsl/entry-point-semantics.shader_test +++ b/tests/hlsl/entry-point-semantics.shader_test @@ -84,7 +84,7 @@ float4 main(in apple a) : sv_target [test] draw quad -todo(sm>=6) probe (0, 0) rgba (10.0, 20.0, 30.0, 40.0) +probe (0, 0) rgba (10.0, 20.0, 30.0, 40.0) % Arrays of matrices get successive indexes. @@ -101,7 +101,12 @@ float4 main(in apple a) : sv_target [test] draw quad -todo(sm>=6) probe (0, 0) rgba (10.0, 11.0, 30.0, 31.0) +probe (0, 0) rgba (10.0, 11.0, 30.0, 31.0) + + +% dxcompiler emits correct array addressing. +[require] +shader model < 6.0 % Arrays (even multi-dimensional) of struct elements are allowed. The fields in the different struct @@ -145,6 +150,10 @@ draw quad todo(sm>=6) probe (0, 0) rgba (10.0, 11.0, 20.0, 21.0) +[require] +% reset requirements + + [pixel shader fail] struct apple { @@ -201,7 +210,7 @@ float4 main(in float4 tex0 : TEXCOORD0, in float4 tex1 : TEXCOORD1) : sv_target [test] draw quad -todo(sm>=6) probe (0, 0) rgba (1.0, 2.0, 10.0, 20.0) +probe (0, 0) rgba (1.0, 2.0, 10.0, 20.0) % Output semantics cannot be mapped to more than one value. @@ -272,7 +281,7 @@ float4 main(in float4 a : TEXCOORD0, in float3 b : TEXCOORD1) : sv_target [test] draw quad -todo(sm>=6) probe (0, 0) rgba (10.0, 11.0, 20.0, 21.0) +probe (0, 0) rgba (10.0, 11.0, 20.0, 21.0) % In SM4, duplicated input semantics can only have different types if they have the same layout and