mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/ir: Validate descriptor types in vsir programs.
This commit is contained in:
committed by
Henri Verbeet
parent
869e6ef583
commit
0da80c1f25
Notes:
Henri Verbeet
2025-04-16 16:52:04 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1447
@@ -8857,6 +8857,21 @@ static void vsir_validate_signature(struct validation_context *ctx, const struct
|
||||
}
|
||||
}
|
||||
|
||||
static void vsir_validate_descriptors(struct validation_context *ctx)
|
||||
{
|
||||
const struct vkd3d_shader_scan_descriptor_info1 *descriptors = &ctx->program->descriptors;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < descriptors->descriptor_count; ++i)
|
||||
{
|
||||
const struct vkd3d_shader_descriptor_info1 *descriptor = &descriptors->descriptors[i];
|
||||
|
||||
if (descriptor->type >= VKD3D_SHADER_DESCRIPTOR_TYPE_COUNT)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DESCRIPTOR_TYPE,
|
||||
"Descriptor %u has invalid type %#x.", i, descriptor->type);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *name_from_cf_type(enum vsir_control_flow_type type)
|
||||
{
|
||||
switch (type)
|
||||
@@ -9823,6 +9838,8 @@ enum vkd3d_result vsir_program_validate(struct vsir_program *program, uint64_t c
|
||||
}
|
||||
}
|
||||
|
||||
vsir_validate_descriptors(&ctx);
|
||||
|
||||
if (!(ctx.temps = vkd3d_calloc(ctx.program->temp_count, sizeof(*ctx.temps))))
|
||||
goto fail;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user