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.
This commit is contained in:
Francisco Casas 2024-02-29 19:32:25 -03:00 committed by Alexandre Julliard
parent 172cb75872
commit 11e7265815
Notes: Alexandre Julliard 2024-03-27 23:07:31 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/724
3 changed files with 12 additions and 11 deletions

View File

@ -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(&reg_symbol, reg);
if (!(entry = rb_get(&compiler->symbol_table, &reg_symbol)))
{
FIXME("Unrecognized register (%s).\n", debug_vkd3d_symbol(&reg_symbol));
spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_INVALID_REGISTER_TYPE,
"Unrecognized register (%s).\n", debug_vkd3d_symbol(&reg_symbol));
memset(register_info, 0, sizeof(*register_info));
return false;
}

View File

@ -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)

View File

@ -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)