mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Pass a pointer to struct hlsl_reg_reservation in parse_reservation_index.
Instead of passing the struct components individually.
This commit is contained in:
parent
e13eb64d4c
commit
8fb3b604bf
Notes:
Henri Verbeet
2024-07-08 18:04:49 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/792
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user