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: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
09b2e42e92
commit
1947f7fb80
|
@ -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)
|
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));
|
struct hlsl_ir_jump *jump = d3dcompiler_alloc(sizeof(*jump));
|
||||||
if (!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.type = HLSL_IR_JUMP;
|
||||||
jump->node.loc = loc;
|
jump->node.loc = loc;
|
||||||
jump->type = HLSL_IR_JUMP_RETURN;
|
jump->type = HLSL_IR_JUMP_RETURN;
|
||||||
jump->node.data_type = hlsl_ctx.cur_function->return_type;
|
|
||||||
if (value)
|
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);
|
d3dcompiler_free(jump);
|
||||||
return NULL;
|
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,
|
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||||
"non-void function must return a value");
|
"non-void function must return a value");
|
||||||
|
|
Loading…
Reference in New Issue