From: Francisco Casas fcasas@codeweavers.com
Otherwise we will transpile d3dbc shaders that use the vPos (or other of these special registers) without properly handling them, which gives invalid results.
Some SM1 tests must be set back to "todo" but they only work because, by coincidence, we are assigning vPos the input register with index 0. Propper mapping of these registers is required. --- libs/vkd3d-shader/spirv.c | 8 +++++++- tests/hlsl/ddxddy.shader_test | 6 +++--- tests/hlsl/fwidth.shader_test | 12 ++++++------ 3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 43d79da9e..df06314da 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -3396,7 +3396,7 @@ struct vkd3d_shader_register_info bool is_aggregate; };
-static bool spirv_compiler_get_register_info(const struct spirv_compiler *compiler, +static bool spirv_compiler_get_register_info(struct spirv_compiler *compiler, const struct vkd3d_shader_register *reg, struct vkd3d_shader_register_info *register_info) { struct vkd3d_symbol reg_symbol, *symbol; @@ -3419,6 +3419,12 @@ static bool spirv_compiler_get_register_info(const struct spirv_compiler *compil return true; }
+ if (reg->type == VKD3DSPR_MISCTYPE) + { + spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_INVALID_REGISTER_TYPE, + "Unmapped VKD3DSPR_MISCTYPE register."); + } + vkd3d_symbol_make_register(®_symbol, reg); if (!(entry = rb_get(&compiler->symbol_table, ®_symbol))) { diff --git a/tests/hlsl/ddxddy.shader_test b/tests/hlsl/ddxddy.shader_test index 72925b975..f61b560c9 100644 --- a/tests/hlsl/ddxddy.shader_test +++ b/tests/hlsl/ddxddy.shader_test @@ -8,8 +8,8 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad -todo(sm<4) probe all rgba (1.0, 1.0, 0.0, 0.0) +todo(sm<4) draw quad +probe all rgba (1.0, 1.0, 0.0, 0.0)
[pixel shader] @@ -29,7 +29,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo(sm<4) draw quad todo(sm<4) probe (10, 10) rgba (-16.0, -5.0, 3.0, 0.0) todo(sm<4) probe (11, 10) rgba (-21.0, -5.0, 3.0, 0.0) todo(sm<4) probe (10, 11) rgba (-13.0, -5.0, 3.0, 0.0) diff --git a/tests/hlsl/fwidth.shader_test b/tests/hlsl/fwidth.shader_test index be3ad0925..10ed712d2 100644 --- a/tests/hlsl/fwidth.shader_test +++ b/tests/hlsl/fwidth.shader_test @@ -18,9 +18,9 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -todo(sm>=6) draw quad -todo(sm<4) probe (10, 10) rgba (8.0, 8.0, 8.0, 8.0) -todo(sm<4) probe (11, 10) rgba (8.0, 8.0, 8.0, 8.0) -todo(sm<4) probe (12, 10) rgba (10.0, 10.0, 10.0, 10.0) -todo(sm<4) probe (16, 16) rgba (12.0, 12.0, 12.0, 12.0) -todo(sm<4) probe (150, 150) rgba (92.0, 92.0, 92.0, 92.0) +todo(sm<4 | sm>=6) draw quad +probe (10, 10) rgba (8.0, 8.0, 8.0, 8.0) +probe (11, 10) rgba (8.0, 8.0, 8.0, 8.0) +probe (12, 10) rgba (10.0, 10.0, 10.0, 10.0) +probe (16, 16) rgba (12.0, 12.0, 12.0, 12.0) +probe (150, 150) rgba (92.0, 92.0, 92.0, 92.0)