Module: vkd3d Branch: master Commit: 8fb3b604bfa9a6379b594fad9d170cca014163a0 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/8fb3b604bfa9a6379b594fad9d170c...
Author: Victor Chiletto vchiletto@codeweavers.com Date: Wed Jul 3 14:05:58 2024 -0300
vkd3d-shader/hlsl: Pass a pointer to struct hlsl_reg_reservation in parse_reservation_index.
Instead of passing the struct components individually.
---
libs/vkd3d-shader/hlsl.y | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 54227041..edb24911 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1214,19 +1214,20 @@ static bool add_effect_group(struct hlsl_ctx *ctx, const char *name, struct hlsl return true; }
-static bool parse_reservation_index(const char *string, char *type, uint32_t *index, unsigned int bracket_offset) +static bool parse_reservation_index(const char *string, unsigned int bracket_offset, + struct hlsl_reg_reservation *reservation) { char *endptr;
- *type = ascii_tolower(string[0]); + reservation->reg_type = ascii_tolower(string[0]);
if (string[1] == '\0') { - *index = bracket_offset; + reservation->reg_index = bracket_offset; return true; }
- *index = strtoul(string + 1, &endptr, 10) + bracket_offset; + reservation->reg_index = strtoul(string + 1, &endptr, 10) + bracket_offset;
if (endptr == string + 1) return false; @@ -6556,7 +6557,7 @@ register_reservation: ':' KW_REGISTER '(' any_identifier ')' { memset(&$$, 0, sizeof($$)); - if (!parse_reservation_index($4, &$$.reg_type, &$$.reg_index, 0)) + if (!parse_reservation_index($4, 0, &$$)) hlsl_error(ctx, &@4, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION, "Invalid register reservation '%s'.", $4);
@@ -6565,8 +6566,7 @@ register_reservation: | ':' KW_REGISTER '(' any_identifier '[' expr ']' ')' { memset(&$$, 0, sizeof($$)); - if (!parse_reservation_index($4, &$$.reg_type, &$$.reg_index, - evaluate_static_expression_as_uint(ctx, $6, &@6))) + if (!parse_reservation_index($4, evaluate_static_expression_as_uint(ctx, $6, &@6), &$$)) { hlsl_error(ctx, &@4, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION, "Invalid register reservation '%s'.", $4); @@ -6578,13 +6578,13 @@ register_reservation: | ':' KW_REGISTER '(' any_identifier ',' any_identifier ')' { memset(&$$, 0, sizeof($$)); - if (parse_reservation_index($6, &$$.reg_type, &$$.reg_index, 0)) + if (parse_reservation_index($6, 0, &$$)) { hlsl_fixme(ctx, &@4, "Reservation shader target %s.", $4); } else if (parse_reservation_space($6, &$$.reg_space)) { - if (!parse_reservation_index($4, &$$.reg_type, &$$.reg_index, 0)) + if (!parse_reservation_index($4, 0, &$$)) hlsl_error(ctx, &@4, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION, "Invalid register reservation '%s'.", $4); } @@ -6605,8 +6605,7 @@ register_reservation: hlsl_error(ctx, &@9, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION, "Invalid register space reservation '%s'.", $9);
- if (!parse_reservation_index($4, &$$.reg_type, &$$.reg_index, - evaluate_static_expression_as_uint(ctx, $6, &@6))) + if (!parse_reservation_index($4, evaluate_static_expression_as_uint(ctx, $6, &@6), &$$)) { hlsl_error(ctx, &@4, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION, "Invalid register reservation '%s'.", $4); @@ -6621,8 +6620,7 @@ register_reservation: hlsl_fixme(ctx, &@4, "Reservation shader target %s.", $4);
memset(&$$, 0, sizeof($$)); - if (!parse_reservation_index($6, &$$.reg_type, &$$.reg_index, - evaluate_static_expression_as_uint(ctx, $8, &@8))) + if (!parse_reservation_index($6, evaluate_static_expression_as_uint(ctx, $8, &@8), &$$)) { hlsl_error(ctx, &@6, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION, "Invalid register reservation '%s'.", $6); @@ -6637,7 +6635,7 @@ register_reservation: hlsl_fixme(ctx, &@4, "Reservation shader target %s.", $4);
memset(&$$, 0, sizeof($$)); - if (!parse_reservation_index($6, &$$.reg_type, &$$.reg_index, 0)) + if (!parse_reservation_index($6, 0, &$$)) hlsl_error(ctx, &@6, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION, "Invalid register reservation '%s'.", $6);
@@ -6654,8 +6652,7 @@ register_reservation: hlsl_fixme(ctx, &@4, "Reservation shader target %s.", $4);
memset(&$$, 0, sizeof($$)); - if (!parse_reservation_index($6, &$$.reg_type, &$$.reg_index, - evaluate_static_expression_as_uint(ctx, $8, &@8))) + if (!parse_reservation_index($6, evaluate_static_expression_as_uint(ctx, $8, &@8), &$$)) { hlsl_error(ctx, &@6, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION, "Invalid register reservation '%s'.", $6);