vkd3d-shader/ir: Validate the register dimension.

This commit is contained in:
Giovanni Mascellani 2023-10-24 19:43:31 -05:00 committed by Alexandre Julliard
parent f3a20be35a
commit 26e4191d4b
Notes: Alexandre Julliard 2023-11-02 22:49:42 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/432
3 changed files with 9 additions and 0 deletions

View File

@ -1506,6 +1506,10 @@ static void vsir_validate_register(struct validation_context *ctx,
if (reg->data_type >= VKD3D_DATA_COUNT)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE, "Invalid register data type %#x.",
reg->data_type);
if (reg->dimension >= VSIR_DIMENSION_COUNT)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION, "Invalid register dimension %#x.",
reg->dimension);
}
static void vsir_validate_dst_param(struct validation_context *ctx,

View File

@ -549,6 +549,8 @@ static enum vkd3d_sm4_dimension sm4_dimension_from_vsir_dimension(enum vsir_dime
return VKD3D_SM4_DIMENSION_SCALAR;
case VSIR_DIMENSION_VEC4:
return VKD3D_SM4_DIMENSION_VEC4;
case VSIR_DIMENSION_COUNT:
vkd3d_unreachable();
}
vkd3d_unreachable();
}

View File

@ -202,6 +202,7 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_VSIR_INVALID_SWIZZLE = 9006,
VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION = 9007,
VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE = 9008,
VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION = 9009,
};
enum vkd3d_shader_opcode
@ -601,6 +602,8 @@ enum vsir_dimension
VSIR_DIMENSION_NONE,
VSIR_DIMENSION_SCALAR,
VSIR_DIMENSION_VEC4,
VSIR_DIMENSION_COUNT,
};
enum vkd3d_shader_src_modifier