Module: vkd3d
Branch: master
Commit: e3dde09bb99e3173c447d509734469a2b702ce6a
URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/e3dde09bb99e3173c447d50973446…
Author: Conor McCarthy <cmccarthy(a)codeweavers.com>
Date: Wed Apr 24 00:23:12 2024 +1000
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).
---
libs/vkd3d-shader/ir.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c
index 62292f16..552de311 100644
--- a/libs/vkd3d-shader/ir.c
+++ b/libs/vkd3d-shader/ir.c
@@ -5971,7 +5971,8 @@ static void vsir_validate_instruction(struct validation_context *ctx)
unsigned int value_idx = 2 * i;
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,
"Invalid value register for incoming %zu of type %#x in PHI instruction, "
"expected SSA, IMMCONST or IMMCONST64.", i, instruction->src[value_idx].reg.type);