vkd3d-shader/hlsl: Get rid of hlsl_type_is_void().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-10-03 19:19:06 -05:00 committed by Alexandre Julliard
parent ded7b381e5
commit 12acfd9724
3 changed files with 3 additions and 9 deletions

View File

@ -640,11 +640,6 @@ struct hlsl_ir_loop *hlsl_new_loop(struct hlsl_ctx *ctx, struct vkd3d_shader_loc
return loop; return loop;
} }
bool hlsl_type_is_void(const struct hlsl_type *type)
{
return type->type == HLSL_CLASS_OBJECT && type->base_type == HLSL_TYPE_VOID;
}
struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hlsl_type *return_type, struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hlsl_type *return_type,
struct list *parameters, const struct hlsl_semantic *semantic, struct vkd3d_shader_location loc) struct list *parameters, const struct hlsl_semantic *semantic, struct vkd3d_shader_location loc)
{ {
@ -656,7 +651,7 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hl
decl->parameters = parameters; decl->parameters = parameters;
decl->loc = loc; decl->loc = loc;
if (!hlsl_type_is_void(return_type)) if (!hlsl_types_are_equal(return_type, ctx->builtin_types.Void))
{ {
struct hlsl_ir_var *return_var; struct hlsl_ir_var *return_var;
char name[28]; char name[28];

View File

@ -683,7 +683,6 @@ struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
unsigned int default_majority, unsigned int modifiers); unsigned int default_majority, unsigned int modifiers);
unsigned int hlsl_type_component_count(struct hlsl_type *type); unsigned int hlsl_type_component_count(struct hlsl_type *type);
unsigned int hlsl_type_get_sm4_offset(const struct hlsl_type *type, unsigned int offset); unsigned int hlsl_type_get_sm4_offset(const struct hlsl_type *type, unsigned int offset);
bool hlsl_type_is_void(const struct hlsl_type *type);
bool hlsl_types_are_equal(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);
unsigned int hlsl_combine_swizzles(unsigned int first, unsigned int second, unsigned int dim); unsigned int hlsl_combine_swizzles(unsigned int first, unsigned int second, unsigned int dim);

View File

@ -506,7 +506,7 @@ static struct hlsl_ir_jump *add_return(struct hlsl_ctx *ctx, struct list *instrs
return NULL; return NULL;
list_add_after(&return_value->entry, &store->node.entry); list_add_after(&return_value->entry, &store->node.entry);
} }
else if (!hlsl_type_is_void(return_type)) else if (ctx->cur_function->return_var)
{ {
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_RETURN, "Non-void function must return a value."); hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_RETURN, "Non-void function must return a value.");
return NULL; return NULL;
@ -2210,7 +2210,7 @@ func_prototype:
"\"%s\" was previously declared here.", $3); "\"%s\" was previously declared here.", $3);
YYABORT; YYABORT;
} }
if (hlsl_type_is_void($2) && $7.semantic.name) if (hlsl_types_are_equal($2, ctx->builtin_types.Void) && $7.semantic.name)
{ {
hlsl_error(ctx, @7, VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC, hlsl_error(ctx, @7, VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC,
"Semantics are not allowed on void functions."); "Semantics are not allowed on void functions.");