vkd3d-shader/hlsl: Return bool from compare_function_decl().

This commit is contained in:
Zebediah Figura 2023-09-08 16:47:19 -05:00 committed by Alexandre Julliard
parent fef118555c
commit 8f041fbe6f
Notes: Alexandre Julliard 2023-11-10 00:10:07 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/454

View File

@ -2098,21 +2098,20 @@ static int compare_param_hlsl_types(const struct hlsl_type *t1, const struct hls
return 0; return 0;
} }
static int compare_function_decl(const struct hlsl_ir_function_decl *decl, static bool func_decl_matches(const struct hlsl_ir_function_decl *decl,
const struct hlsl_func_parameters *parameters) const struct hlsl_func_parameters *parameters)
{ {
size_t i; size_t i;
int r;
if ((r = vkd3d_u32_compare(parameters->count, decl->parameters.count))) if (parameters->count != decl->parameters.count)
return r; return false;
for (i = 0; i < parameters->count; ++i) for (i = 0; i < parameters->count; ++i)
{ {
if ((r = compare_param_hlsl_types(parameters->vars[i]->data_type, decl->parameters.vars[i]->data_type))) if (compare_param_hlsl_types(parameters->vars[i]->data_type, decl->parameters.vars[i]->data_type))
return r; return false;
} }
return 0; return true;
} }
struct hlsl_ir_function_decl *hlsl_get_func_decl(struct hlsl_ctx *ctx, const char *name, struct hlsl_ir_function_decl *hlsl_get_func_decl(struct hlsl_ctx *ctx, const char *name,
@ -2126,7 +2125,7 @@ struct hlsl_ir_function_decl *hlsl_get_func_decl(struct hlsl_ctx *ctx, const cha
LIST_FOR_EACH_ENTRY(decl, &func->overloads, struct hlsl_ir_function_decl, entry) LIST_FOR_EACH_ENTRY(decl, &func->overloads, struct hlsl_ir_function_decl, entry)
{ {
if (!compare_function_decl(decl, parameters)) if (func_decl_matches(decl, parameters))
return decl; return decl;
} }