mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader: Rename hlsl_type_compare() to hlsl_types_are_equal().
hlsl_type_compare() implies a stable comparison function, as if to be passed to qsort(). Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
588d3e5a57
commit
3ac20487f8
@ -230,7 +230,7 @@ unsigned int hlsl_type_component_count(struct hlsl_type *type)
|
||||
return count;
|
||||
}
|
||||
|
||||
bool hlsl_type_compare(const struct hlsl_type *t1, const struct hlsl_type *t2)
|
||||
bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2)
|
||||
{
|
||||
if (t1 == t2)
|
||||
return true;
|
||||
@ -259,7 +259,7 @@ bool hlsl_type_compare(const struct hlsl_type *t1, const struct hlsl_type *t2)
|
||||
{
|
||||
t1field = LIST_ENTRY(t1cur, struct hlsl_struct_field, entry);
|
||||
t2field = LIST_ENTRY(t2cur, struct hlsl_struct_field, entry);
|
||||
if (!hlsl_type_compare(t1field->type, t2field->type))
|
||||
if (!hlsl_types_are_equal(t1field->type, t2field->type))
|
||||
return false;
|
||||
if (strcmp(t1field->name, t2field->name))
|
||||
return false;
|
||||
@ -271,7 +271,7 @@ bool hlsl_type_compare(const struct hlsl_type *t1, const struct hlsl_type *t2)
|
||||
}
|
||||
if (t1->type == HLSL_CLASS_ARRAY)
|
||||
return t1->e.array.elements_count == t2->e.array.elements_count
|
||||
&& hlsl_type_compare(t1->e.array.type, t2->e.array.type);
|
||||
&& hlsl_types_are_equal(t1->e.array.type, t2->e.array.type);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -473,7 +473,7 @@ struct hlsl_ir_node *hlsl_new_binary_expr(enum hlsl_ir_expr_op op, struct hlsl_i
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
|
||||
assert(hlsl_type_compare(arg1->data_type, arg2->data_type));
|
||||
assert(hlsl_types_are_equal(arg1->data_type, arg2->data_type));
|
||||
|
||||
if (!(expr = vkd3d_calloc(1, sizeof(*expr))))
|
||||
return NULL;
|
||||
|
@ -563,10 +563,10 @@ bool hlsl_scope_add_type(struct hlsl_scope *scope, struct hlsl_type *type) DECLS
|
||||
|
||||
struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
|
||||
unsigned int default_majority) DECLSPEC_HIDDEN;
|
||||
bool hlsl_type_compare(const struct hlsl_type *t1, const struct hlsl_type *t2) DECLSPEC_HIDDEN;
|
||||
unsigned int hlsl_type_component_count(struct hlsl_type *type) DECLSPEC_HIDDEN;
|
||||
bool hlsl_type_is_row_major(const struct hlsl_type *type) DECLSPEC_HIDDEN;
|
||||
bool hlsl_type_is_void(const struct hlsl_type *type) DECLSPEC_HIDDEN;
|
||||
bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2) DECLSPEC_HIDDEN;
|
||||
|
||||
int hlsl_lexer_compile(struct hlsl_ctx *ctx, const struct vkd3d_shader_code *hlsl) DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -169,7 +169,7 @@ static bool compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2)
|
||||
|
||||
if (t1->type == HLSL_CLASS_ARRAY)
|
||||
{
|
||||
if (hlsl_type_compare(t1->e.array.type, t2))
|
||||
if (hlsl_types_are_equal(t1->e.array.type, t2))
|
||||
/* e.g. float4[3] to float4 is allowed */
|
||||
return true;
|
||||
|
||||
@ -226,7 +226,7 @@ static bool implicit_compatible_data_types(struct hlsl_type *t1, struct hlsl_typ
|
||||
|| (t1->type <= HLSL_CLASS_LAST_NUMERIC && t2->type == HLSL_CLASS_ARRAY))
|
||||
{
|
||||
/* e.g. float4[3] to float4 is allowed */
|
||||
if (t1->type == HLSL_CLASS_ARRAY && hlsl_type_compare(t1->e.array.type, t2))
|
||||
if (t1->type == HLSL_CLASS_ARRAY && hlsl_types_are_equal(t1->e.array.type, t2))
|
||||
return true;
|
||||
if (hlsl_type_component_count(t1) == hlsl_type_component_count(t2))
|
||||
return true;
|
||||
@ -254,7 +254,7 @@ static bool implicit_compatible_data_types(struct hlsl_type *t1, struct hlsl_typ
|
||||
}
|
||||
|
||||
if (t1->type == HLSL_CLASS_STRUCT && t2->type == HLSL_CLASS_STRUCT)
|
||||
return hlsl_type_compare(t1, t2);
|
||||
return hlsl_types_are_equal(t1, t2);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -265,7 +265,7 @@ static struct hlsl_ir_node *add_implicit_conversion(struct hlsl_ctx *ctx, struct
|
||||
struct hlsl_type *src_type = node->data_type;
|
||||
struct hlsl_ir_expr *cast;
|
||||
|
||||
if (hlsl_type_compare(src_type, dst_type))
|
||||
if (hlsl_types_are_equal(src_type, dst_type))
|
||||
return node;
|
||||
|
||||
if (!implicit_compatible_data_types(src_type, dst_type))
|
||||
@ -1046,7 +1046,7 @@ static struct hlsl_type *expr_common_type(struct hlsl_ctx *ctx, struct hlsl_type
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (hlsl_type_compare(t1, t2))
|
||||
if (hlsl_types_are_equal(t1, t2))
|
||||
return t1;
|
||||
|
||||
if (!expr_compatible_data_types(t1, t2))
|
||||
@ -1158,7 +1158,7 @@ static struct hlsl_ir_expr *add_expr(struct hlsl_ctx *ctx, struct list *instrs,
|
||||
|
||||
if (!operands[i])
|
||||
break;
|
||||
if (hlsl_type_compare(operands[i]->data_type, type))
|
||||
if (hlsl_types_are_equal(operands[i]->data_type, type))
|
||||
continue;
|
||||
if (operands[i]->data_type->dimx * operands[i]->data_type->dimy != 1
|
||||
&& operands[i]->data_type->dimx * operands[i]->data_type->dimy != type->dimx * type->dimy)
|
||||
@ -1799,7 +1799,7 @@ hlsl_prog:
|
||||
hlsl_note(ctx, decl->loc, VKD3D_SHADER_LOG_ERROR, "\"%s\" was previously defined here.", $2.name);
|
||||
YYABORT;
|
||||
}
|
||||
else if (!hlsl_type_compare(decl->return_type, $2.decl->return_type))
|
||||
else if (!hlsl_types_are_equal(decl->return_type, $2.decl->return_type))
|
||||
{
|
||||
hlsl_error(ctx, $2.decl->loc, VKD3D_SHADER_ERROR_HLSL_REDEFINED,
|
||||
"Function \"%s\" was already declared with a different return type.", $2.name);
|
||||
|
@ -73,7 +73,7 @@ static bool fold_redundant_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst
|
||||
if (expr->op != HLSL_IR_UNOP_CAST)
|
||||
return false;
|
||||
|
||||
if (hlsl_type_compare(src_type, dst_type)
|
||||
if (hlsl_types_are_equal(src_type, dst_type)
|
||||
|| (src_type->base_type == dst_type->base_type && is_vec1(src_type) && is_vec1(dst_type)))
|
||||
{
|
||||
replace_node(&expr->node, expr->operands[0].node);
|
||||
|
Loading…
x
Reference in New Issue
Block a user