Module: vkd3d Branch: master Commit: 11e7265815883b2c545c1957a498b96f226b7f01 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/11e7265815883b2c545c1957a498b9... Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Thu Feb 29 19:32:25 2024 -0300 vkd3d-shader/spirv: Throw compiler error on unrecognized register. This codepath path is currently triggered when transpiling d3dbc shaders that use vPos (or other of these special registers). While vPos gets added to the input signature and gets assigned an INPUT register, the registers in the shader instructions are still of VKD3DSPR_MISCTYPE type and are not propperly mapped yet. This 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 still required. --- libs/vkd3d-shader/spirv.c | 5 +++-- tests/hlsl/ddxddy.shader_test | 6 +++--- tests/hlsl/fwidth.shader_test | 12 ++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 76856bd4..ede7c623 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; @@ -3422,7 +3422,8 @@ static bool spirv_compiler_get_register_info(const struct spirv_compiler *compil vkd3d_symbol_make_register(®_symbol, reg); if (!(entry = rb_get(&compiler->symbol_table, ®_symbol))) { - FIXME("Unrecognized register (%s).\n", debug_vkd3d_symbol(®_symbol)); + spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_INVALID_REGISTER_TYPE, + "Unrecognized register (%s).\n", debug_vkd3d_symbol(®_symbol)); memset(register_info, 0, sizeof(*register_info)); return false; } diff --git a/tests/hlsl/ddxddy.shader_test b/tests/hlsl/ddxddy.shader_test index c0db937f..47b8391d 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] -todo(glsl) draw quad -todo(sm<4) probe all rgba (1.0, 1.0, 0.0, 0.0) +todo(sm<4 | glsl) 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] -todo(glsl) draw quad +todo(sm<4 | glsl) 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 0c682d17..3ba116a5 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(glsl) 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 | glsl) 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)