mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Use profile version testing helpers in more places.
This commit is contained in:
parent
5c02e12187
commit
9ccf291971
Notes:
Alexandre Julliard
2023-06-27 23:34:12 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/237
@ -832,6 +832,11 @@ static bool shader_profile_version_ge(const struct hlsl_ctx *ctx, unsigned int m
|
||||
return ctx->profile->major_version > major || (ctx->profile->major_version == major && ctx->profile->minor_version >= minor);
|
||||
}
|
||||
|
||||
static bool shader_profile_version_lt(const struct hlsl_ctx *ctx, unsigned int major, unsigned int minor)
|
||||
{
|
||||
return !shader_profile_version_ge(ctx, major, minor);
|
||||
}
|
||||
|
||||
static bool gen_struct_fields(struct hlsl_ctx *ctx, struct parse_fields *fields,
|
||||
struct hlsl_type *type, unsigned int modifiers, struct list *defs)
|
||||
{
|
||||
@ -1022,7 +1027,7 @@ static struct hlsl_reg_reservation parse_packoffset(struct hlsl_ctx *ctx, const
|
||||
struct hlsl_reg_reservation reservation = {0};
|
||||
char *endptr;
|
||||
|
||||
if (ctx->profile->major_version < 4)
|
||||
if (shader_profile_version_lt(ctx, 4, 0))
|
||||
return reservation;
|
||||
|
||||
reservation.offset_index = strtoul(reg_string + 1, &endptr, 10);
|
||||
@ -3488,7 +3493,7 @@ static bool intrinsic_d3dcolor_to_ubyte4(struct hlsl_ctx *ctx,
|
||||
if (!(ret = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, arg, c, loc)))
|
||||
return false;
|
||||
|
||||
if (ctx->profile->major_version >= 4)
|
||||
if (shader_profile_version_ge(ctx, 4, 0))
|
||||
return !!add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_TRUNC, ret, loc);
|
||||
|
||||
return true;
|
||||
@ -5292,7 +5297,7 @@ type_no_void:
|
||||
{
|
||||
validate_texture_format_type(ctx, $3, &@3);
|
||||
|
||||
if (!shader_profile_version_ge(ctx, 4, 1))
|
||||
if (shader_profile_version_lt(ctx, 4, 1))
|
||||
{
|
||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||
"Multisampled texture object declaration needs sample count for profile %s.", ctx->profile->name);
|
||||
@ -5361,7 +5366,7 @@ type_no_void:
|
||||
$$ = hlsl_get_type(ctx->cur_scope, $1, true, true);
|
||||
if ($$->is_minimum_precision)
|
||||
{
|
||||
if (ctx->profile->major_version < 4)
|
||||
if (shader_profile_version_lt(ctx, 4, 0))
|
||||
{
|
||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||
"Target profile doesn't support minimum-precision types.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user