mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Validate tessellation system values for the given tessellator domain.
This commit is contained in:
parent
1ed8d907b3
commit
018f3e8094
Notes:
Henri Verbeet
2024-11-21 19:36:02 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1266
@ -7473,6 +7473,7 @@ static void vsir_validate_signature_element(struct validation_context *ctx,
|
|||||||
const struct shader_signature *signature, enum vsir_signature_type signature_type,
|
const struct shader_signature *signature, enum vsir_signature_type signature_type,
|
||||||
unsigned int idx)
|
unsigned int idx)
|
||||||
{
|
{
|
||||||
|
enum vkd3d_tessellator_domain expected_tess_domain = VKD3D_TESSELLATOR_DOMAIN_INVALID;
|
||||||
const char *signature_type_name = signature_type_names[signature_type];
|
const char *signature_type_name = signature_type_names[signature_type];
|
||||||
const struct signature_element *element = &signature->elements[idx];
|
const struct signature_element *element = &signature->elements[idx];
|
||||||
bool integer_type = false, is_outer = false;
|
bool integer_type = false, is_outer = false;
|
||||||
@ -7537,27 +7538,32 @@ static void vsir_validate_signature_element(struct validation_context *ctx,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VKD3D_SHADER_SV_TESS_FACTOR_QUADEDGE:
|
case VKD3D_SHADER_SV_TESS_FACTOR_QUADEDGE:
|
||||||
|
expected_tess_domain = VKD3D_TESSELLATOR_DOMAIN_QUAD;
|
||||||
semantic_index_max = 4;
|
semantic_index_max = 4;
|
||||||
is_outer = true;
|
is_outer = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VKD3D_SHADER_SV_TESS_FACTOR_QUADINT:
|
case VKD3D_SHADER_SV_TESS_FACTOR_QUADINT:
|
||||||
|
expected_tess_domain = VKD3D_TESSELLATOR_DOMAIN_QUAD;
|
||||||
semantic_index_max = 2;
|
semantic_index_max = 2;
|
||||||
is_outer = false;
|
is_outer = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VKD3D_SHADER_SV_TESS_FACTOR_TRIEDGE:
|
case VKD3D_SHADER_SV_TESS_FACTOR_TRIEDGE:
|
||||||
|
expected_tess_domain = VKD3D_TESSELLATOR_DOMAIN_TRIANGLE;
|
||||||
semantic_index_max = 3;
|
semantic_index_max = 3;
|
||||||
is_outer = true;
|
is_outer = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VKD3D_SHADER_SV_TESS_FACTOR_TRIINT:
|
case VKD3D_SHADER_SV_TESS_FACTOR_TRIINT:
|
||||||
|
expected_tess_domain = VKD3D_TESSELLATOR_DOMAIN_TRIANGLE;
|
||||||
semantic_index_max = 1;
|
semantic_index_max = 1;
|
||||||
is_outer = false;
|
is_outer = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VKD3D_SHADER_SV_TESS_FACTOR_LINEDET:
|
case VKD3D_SHADER_SV_TESS_FACTOR_LINEDET:
|
||||||
case VKD3D_SHADER_SV_TESS_FACTOR_LINEDEN:
|
case VKD3D_SHADER_SV_TESS_FACTOR_LINEDEN:
|
||||||
|
expected_tess_domain = VKD3D_TESSELLATOR_DOMAIN_LINE;
|
||||||
semantic_index_max = 2;
|
semantic_index_max = 2;
|
||||||
is_outer = true;
|
is_outer = true;
|
||||||
break;
|
break;
|
||||||
@ -7569,8 +7575,13 @@ static void vsir_validate_signature_element(struct validation_context *ctx,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (semantic_index_max != 0)
|
if (expected_tess_domain != VKD3D_TESSELLATOR_DOMAIN_INVALID)
|
||||||
{
|
{
|
||||||
|
if (ctx->program->tess_domain != expected_tess_domain)
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE,
|
||||||
|
"element %u of %s signature: Invalid system value semantic %#x for tessellator domain %#x.",
|
||||||
|
idx, signature_type_name, element->sysval_semantic, ctx->program->tess_domain);
|
||||||
|
|
||||||
if (element->semantic_index >= semantic_index_max)
|
if (element->semantic_index >= semantic_index_max)
|
||||||
{
|
{
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE,
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE,
|
||||||
|
Loading…
Reference in New Issue
Block a user