vkd3d-shader/dxil: Rewrite sm6_value_is_constant_zero() in terms of the SM6 value.

Instead of using the VSIR register.
This commit is contained in:
Giovanni Mascellani
2025-05-13 11:40:20 +02:00
committed by Henri Verbeet
parent 31e4cbba2e
commit 59fb3a7893
Notes: Henri Verbeet 2025-06-10 18:06:02 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1546
2 changed files with 7 additions and 8 deletions

View File

@@ -2272,8 +2272,13 @@ static inline bool sm6_value_is_constant(const struct sm6_value *value)
static bool sm6_value_is_constant_zero(const struct sm6_value *value)
{
/* Constant vectors do not occur. */
return sm6_value_is_register(value) && register_is_scalar_constant_zero(&value->reg);
if (value->value_type != VALUE_TYPE_CONSTANT || value->type->class != TYPE_CLASS_INTEGER)
return false;
if (value->type->u.width == 64)
return value->u.constant.immconst.immconst_u64[0] == 0;
else
return value->u.constant.immconst.immconst_u32[0] == 0;
}
static inline bool sm6_value_is_undef(const struct sm6_value *value)

View File

@@ -1337,12 +1337,6 @@ static inline bool register_is_constant_or_undef(const struct vkd3d_shader_regis
return register_is_constant(reg) || register_is_undef(reg);
}
static inline bool register_is_scalar_constant_zero(const struct vkd3d_shader_register *reg)
{
return register_is_constant(reg) && reg->dimension == VSIR_DIMENSION_SCALAR
&& (data_type_is_64_bit(reg->data_type) ? !reg->u.immconst_u64[0] : !reg->u.immconst_u32[0]);
}
static inline bool register_is_numeric_array(const struct vkd3d_shader_register *reg)
{
return (reg->type == VKD3DSPR_IMMCONSTBUFFER || reg->type == VKD3DSPR_IDXTEMP