mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Validate register counts in input signatures.
This commit is contained in:
parent
7202e6e2f3
commit
118f494de3
Notes:
Henri Verbeet
2024-10-09 13:19:13 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1159
@ -6505,6 +6505,26 @@ static bool vsir_validate_src_max_count(struct validation_context *ctx,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vsir_validate_signature_element(struct validation_context *ctx,
|
||||||
|
const struct shader_signature *signature, const char *signature_type,
|
||||||
|
unsigned int idx)
|
||||||
|
{
|
||||||
|
const struct signature_element *element = &signature->elements[idx];
|
||||||
|
|
||||||
|
if (element->register_count == 0)
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE,
|
||||||
|
"element %u of %s signature: Invalid zero register count.", idx, signature_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void vsir_validate_signature(struct validation_context *ctx,
|
||||||
|
const struct shader_signature *signature, const char *signature_type)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < signature->element_count; ++i)
|
||||||
|
vsir_validate_signature_element(ctx, signature, signature_type, i);
|
||||||
|
}
|
||||||
|
|
||||||
static const char *name_from_cf_type(enum vsir_control_flow_type type)
|
static const char *name_from_cf_type(enum vsir_control_flow_type type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
@ -7054,6 +7074,8 @@ enum vkd3d_result vsir_program_validate(struct vsir_program *program, uint64_t c
|
|||||||
"Patch constant signature is only valid for hull and domain shaders.");
|
"Patch constant signature is only valid for hull and domain shaders.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vsir_validate_signature(&ctx, &program->input_signature, "input");
|
||||||
|
|
||||||
if (!(ctx.temps = vkd3d_calloc(ctx.program->temp_count, sizeof(*ctx.temps))))
|
if (!(ctx.temps = vkd3d_calloc(ctx.program->temp_count, sizeof(*ctx.temps))))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user