vkd3d-shader/ir: Validate geometry shader properties.

This commit is contained in:
Conor McCarthy 2024-04-19 12:45:09 +10:00 committed by Alexandre Julliard
parent 4fd2d5aa77
commit cc49f26af1
Notes: Alexandre Julliard 2024-05-08 22:50:56 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/805
2 changed files with 27 additions and 0 deletions

View File

@ -5753,6 +5753,32 @@ static void vsir_validate_instruction(struct validation_context *ctx)
case VKD3DSIH_DCL_OUTPUT:
return;
case VKD3DSIH_DCL_INPUT_PRIMITIVE:
if (instruction->declaration.primitive_type.type == VKD3D_PT_UNDEFINED
|| instruction->declaration.primitive_type.type >= VKD3D_PT_COUNT)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_GS, "GS input primitive %u is invalid.",
instruction->declaration.primitive_type.type);
return;
case VKD3DSIH_DCL_VERTICES_OUT:
if (instruction->declaration.count > 1024)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_GS, "GS output vertex count %u is invalid.",
instruction->declaration.count);
return;
case VKD3DSIH_DCL_OUTPUT_TOPOLOGY:
if (instruction->declaration.primitive_type.type == VKD3D_PT_UNDEFINED
|| instruction->declaration.primitive_type.type >= VKD3D_PT_COUNT)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_GS, "GS output primitive %u is invalid.",
instruction->declaration.primitive_type.type);
return;
case VKD3DSIH_DCL_GS_INSTANCES:
if (!instruction->declaration.count || instruction->declaration.count > 32)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_GS, "GS instance count %u is invalid.",
instruction->declaration.count);
return;
case VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT:
if (!instruction->declaration.count || instruction->declaration.count > 32)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION, "Output control point count %u is invalid.",

View File

@ -223,6 +223,7 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_VSIR_INVALID_CONTROL_FLOW = 9016,
VKD3D_SHADER_ERROR_VSIR_INVALID_SSA_USAGE = 9017,
VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION = 9018,
VKD3D_SHADER_ERROR_VSIR_INVALID_GS = 9019,
VKD3D_SHADER_WARNING_VSIR_DYNAMIC_DESCRIPTOR_ARRAY = 9300,
};