vkd3d-shader/ir: Accept undefined PHI incomings as valid.

An incoming can be undefined if the PHI result is not used if the
incoming's path was taken, or if the undefined value is consumed by
an instruction (dxc will compile such code without errors).
This commit is contained in:
Conor McCarthy 2024-04-24 00:23:12 +10:00 committed by Alexandre Julliard
parent 836fe05916
commit e3dde09bb9
Notes: Alexandre Julliard 2024-04-23 22:58:41 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/823

View File

@ -5971,7 +5971,8 @@ static void vsir_validate_instruction(struct validation_context *ctx)
unsigned int value_idx = 2 * i; unsigned int value_idx = 2 * i;
unsigned int label_idx = 2 * i + 1; unsigned int label_idx = 2 * i + 1;
if (!register_is_constant(&instruction->src[value_idx].reg) && !register_is_ssa(&instruction->src[value_idx].reg)) if (!register_is_constant_or_undef(&instruction->src[value_idx].reg)
&& !register_is_ssa(&instruction->src[value_idx].reg))
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE, validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE,
"Invalid value register for incoming %zu of type %#x in PHI instruction, " "Invalid value register for incoming %zu of type %#x in PHI instruction, "
"expected SSA, IMMCONST or IMMCONST64.", i, instruction->src[value_idx].reg.type); "expected SSA, IMMCONST or IMMCONST64.", i, instruction->src[value_idx].reg.type);