vkd3d-shader/ir: Validate system value semantics in shader signatures.

This commit is contained in:
Giovanni Mascellani 2024-10-09 17:06:36 +02:00 committed by Henri Verbeet
parent 6e14d7ab90
commit 5034e1eeb5
Notes: Henri Verbeet 2024-10-10 20:09:41 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1167

View File

@ -6542,6 +6542,40 @@ static void vsir_validate_signature_element(struct validation_context *ctx,
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE, validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE,
"element %u of %s signature: Invalid usage mask %#x.", "element %u of %s signature: Invalid usage mask %#x.",
idx, signature_type, element->used_mask); idx, signature_type, element->used_mask);
switch (element->sysval_semantic)
{
case VKD3D_SHADER_SV_NONE:
case VKD3D_SHADER_SV_POSITION:
case VKD3D_SHADER_SV_CLIP_DISTANCE:
case VKD3D_SHADER_SV_CULL_DISTANCE:
case VKD3D_SHADER_SV_RENDER_TARGET_ARRAY_INDEX:
case VKD3D_SHADER_SV_VIEWPORT_ARRAY_INDEX:
case VKD3D_SHADER_SV_VERTEX_ID:
case VKD3D_SHADER_SV_PRIMITIVE_ID:
case VKD3D_SHADER_SV_INSTANCE_ID:
case VKD3D_SHADER_SV_IS_FRONT_FACE:
case VKD3D_SHADER_SV_SAMPLE_INDEX:
case VKD3D_SHADER_SV_TESS_FACTOR_QUADEDGE:
case VKD3D_SHADER_SV_TESS_FACTOR_QUADINT:
case VKD3D_SHADER_SV_TESS_FACTOR_TRIEDGE:
case VKD3D_SHADER_SV_TESS_FACTOR_TRIINT:
case VKD3D_SHADER_SV_TESS_FACTOR_LINEDET:
case VKD3D_SHADER_SV_TESS_FACTOR_LINEDEN:
case VKD3D_SHADER_SV_TARGET:
case VKD3D_SHADER_SV_DEPTH:
case VKD3D_SHADER_SV_COVERAGE:
case VKD3D_SHADER_SV_DEPTH_GREATER_EQUAL:
case VKD3D_SHADER_SV_DEPTH_LESS_EQUAL:
case VKD3D_SHADER_SV_STENCIL_REF:
break;
default:
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE,
"element %u of %s signature: Invalid system value semantic %#x.",
idx, signature_type, element->sysval_semantic);
break;
}
} }
static void vsir_validate_signature(struct validation_context *ctx, static void vsir_validate_signature(struct validation_context *ctx,