vkd3d-shader/tpf: Validate signature element masks.

This commit is contained in:
Conor McCarthy 2023-05-03 17:19:32 +10:00 committed by Alexandre Julliard
parent b8e6482365
commit 2166088b0b
Notes: Alexandre Julliard 2023-05-09 22:25:51 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/198
2 changed files with 10 additions and 1 deletions

View File

@ -2203,7 +2203,7 @@ static bool shader_sm4_init(struct vkd3d_shader_sm4_parser *sm4, const uint32_t
static bool shader_sm4_parser_validate_signature(struct vkd3d_shader_sm4_parser *sm4,
const struct shader_signature *signature, const char *name)
{
unsigned int i, register_idx, register_count;
unsigned int i, register_idx, register_count, mask;
for (i = 0; i < signature->element_count; ++i)
{
@ -2218,6 +2218,13 @@ static bool shader_sm4_parser_validate_signature(struct vkd3d_shader_sm4_parser
i, register_idx, register_count, MAX_REG_OUTPUT - 1);
return false;
}
if (!vkd3d_bitmask_is_contiguous(mask = signature->elements[i].mask))
{
WARN("%s signature element %u mask %#x is not contiguous.\n", name, i, mask);
vkd3d_shader_parser_warning(&sm4->p, VKD3D_SHADER_WARNING_TPF_MASK_NOT_CONTIGUOUS,
"%s signature element %u mask %#x is not contiguous.", name, i, mask);
}
}
return true;

View File

@ -77,6 +77,8 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_INDEX_COUNT = 1003,
VKD3D_SHADER_ERROR_TPF_TOO_MANY_REGISTERS = 1004,
VKD3D_SHADER_WARNING_TPF_MASK_NOT_CONTIGUOUS = 1300,
VKD3D_SHADER_ERROR_SPV_DESCRIPTOR_BINDING_NOT_FOUND = 2000,
VKD3D_SHADER_ERROR_SPV_INVALID_REGISTER_TYPE = 2001,
VKD3D_SHADER_ERROR_SPV_INVALID_DESCRIPTOR_BINDING = 2002,