Commit 1947f7fb authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3dcompiler: Don't set the node type for return instructions.

Essentially just because it doesn't make sense to do so; a return instruction is not an expression usable as a source to other instructions. Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 09b2e42e
......@@ -483,6 +483,7 @@ static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ir_node *value, const cha
static struct hlsl_ir_jump *new_return(struct hlsl_ir_node *value, struct source_location loc)
{
struct hlsl_type *return_type = hlsl_ctx.cur_function->return_type;
struct hlsl_ir_jump *jump = d3dcompiler_alloc(sizeof(*jump));
if (!jump)
{
......@@ -492,16 +493,15 @@ static struct hlsl_ir_jump *new_return(struct hlsl_ir_node *value, struct source
jump->node.type = HLSL_IR_JUMP;
jump->node.loc = loc;
jump->type = HLSL_IR_JUMP_RETURN;
jump->node.data_type = hlsl_ctx.cur_function->return_type;
if (value)
{
if (!(jump->return_value = implicit_conversion(value, jump->node.data_type, &loc)))
if (!(jump->return_value = implicit_conversion(value, return_type, &loc)))
{
d3dcompiler_free(jump);
return NULL;
}
}
else if (jump->node.data_type->base_type != HLSL_TYPE_VOID)
else if (return_type->base_type != HLSL_TYPE_VOID)
{
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
"non-void function must return a value");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment