Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com
Il 04/10/21 02:19, Zebediah Figura ha scritto:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
libs/vkd3d-shader/hlsl.c | 7 +------ libs/vkd3d-shader/hlsl.h | 1 - libs/vkd3d-shader/hlsl.y | 4 ++-- 3 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 66ca389a1..f03777a65 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -640,11 +640,6 @@ struct hlsl_ir_loop *hlsl_new_loop(struct hlsl_ctx *ctx, struct vkd3d_shader_loc 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 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->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; char name[28];
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 9686a496b..77b4ce928 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -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 hlsl_type_component_count(struct hlsl_type *type); 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);
unsigned int hlsl_combine_swizzles(unsigned int first, unsigned int second, unsigned int dim); diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index d1ef9eb4a..6f1794e79 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -506,7 +506,7 @@ static struct hlsl_ir_jump *add_return(struct hlsl_ctx *ctx, struct list *instrs return NULL; 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."); return NULL;
@@ -2210,7 +2210,7 @@ func_prototype: ""%s" was previously declared here.", $3); 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, "Semantics are not allowed on void functions.");