vkd3d-shader/ir: Check that signature element masks are left-aligned with in a DCL_INDEX_RANGE.

This commit is contained in:
Giovanni Mascellani 2024-12-05 23:58:32 +01:00 committed by Henri Verbeet
parent 703da18955
commit 267c70fa55
Notes: Henri Verbeet 2024-12-09 16:18:44 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1305

View File

@ -8501,8 +8501,8 @@ static void vsir_validate_dcl_hs_max_tessfactor(struct validation_context *ctx,
static void vsir_validate_dcl_index_range(struct validation_context *ctx, static void vsir_validate_dcl_index_range(struct validation_context *ctx,
const struct vkd3d_shader_instruction *instruction) const struct vkd3d_shader_instruction *instruction)
{ {
unsigned int i, j, base_register_idx, effective_write_mask = 0, control_point_count, first_component = UINT_MAX;
const struct vkd3d_shader_index_range *range = &instruction->declaration.index_range; const struct vkd3d_shader_index_range *range = &instruction->declaration.index_range;
unsigned int i, j, base_register_idx, effective_write_mask = 0, control_point_count;
enum vkd3d_shader_sysval_semantic sysval = ~0u; enum vkd3d_shader_sysval_semantic sysval = ~0u;
const struct shader_signature *signature; const struct shader_signature *signature;
bool has_control_point; bool has_control_point;
@ -8588,6 +8588,12 @@ static void vsir_validate_dcl_index_range(struct validation_context *ctx,
found = true; found = true;
if (first_component == UINT_MAX)
first_component = vsir_write_mask_get_component_idx(element->mask);
else if (first_component != vsir_write_mask_get_component_idx(element->mask))
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_WRITE_MASK,
"Signature masks are not left-aligned within a DCL_INDEX_RANGE.");
effective_write_mask |= element->mask; effective_write_mask |= element->mask;
} }
} }
@ -8645,6 +8651,10 @@ static void vsir_validate_dcl_index_range(struct validation_context *ctx,
"Invalid write mask %#x on a signature element touched by a " "Invalid write mask %#x on a signature element touched by a "
"DCL_INDEX_RANGE instruction with effective write mask %#x.", "DCL_INDEX_RANGE instruction with effective write mask %#x.",
element->mask, effective_write_mask); element->mask, effective_write_mask);
if (first_component != vsir_write_mask_get_component_idx(element->mask))
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_WRITE_MASK,
"Signature element masks are not left-aligned within a DCL_INDEX_RANGE.");
} }
} }