d3dcompiler: Add the assignment node to the instruction list in make_assignment().
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
95ef2fa578
commit
9b3e6b1971
|
@ -1057,6 +1057,9 @@ static inline void init_node(struct hlsl_ir_node *node, enum hlsl_ir_node_type t
|
||||||
node->loc = loc;
|
node->loc = loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct hlsl_ir_node *add_assignment(struct list *instrs, struct hlsl_ir_node *lhs,
|
||||||
|
enum parse_assign_op assign_op, struct hlsl_ir_node *rhs) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
BOOL add_declaration(struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local_var) DECLSPEC_HIDDEN;
|
BOOL add_declaration(struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local_var) DECLSPEC_HIDDEN;
|
||||||
struct hlsl_ir_var *get_variable(struct hlsl_scope *scope, const char *name) DECLSPEC_HIDDEN;
|
struct hlsl_ir_var *get_variable(struct hlsl_scope *scope, const char *name) DECLSPEC_HIDDEN;
|
||||||
void free_declaration(struct hlsl_ir_var *decl) DECLSPEC_HIDDEN;
|
void free_declaration(struct hlsl_ir_var *decl) DECLSPEC_HIDDEN;
|
||||||
|
@ -1076,8 +1079,6 @@ struct hlsl_ir_expr *new_cast(struct hlsl_ir_node *node, struct hlsl_type *type,
|
||||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||||
struct hlsl_ir_node *implicit_conversion(struct hlsl_ir_node *node, struct hlsl_type *type,
|
struct hlsl_ir_node *implicit_conversion(struct hlsl_ir_node *node, struct hlsl_type *type,
|
||||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||||
struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assign_op assign_op,
|
|
||||||
struct hlsl_ir_node *right) DECLSPEC_HIDDEN;
|
|
||||||
void push_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
|
void push_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
|
||||||
BOOL pop_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
|
BOOL pop_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
|
||||||
void init_functions_tree(struct wine_rb_tree *funcs) DECLSPEC_HIDDEN;
|
void init_functions_tree(struct wine_rb_tree *funcs) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -777,7 +777,6 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers,
|
||||||
struct hlsl_type *type;
|
struct hlsl_type *type;
|
||||||
struct parse_variable_def *v, *v_next;
|
struct parse_variable_def *v, *v_next;
|
||||||
struct hlsl_ir_var *var;
|
struct hlsl_ir_var *var;
|
||||||
struct hlsl_ir_node *assignment;
|
|
||||||
BOOL ret, local = TRUE;
|
BOOL ret, local = TRUE;
|
||||||
struct list *statements_list = d3dcompiler_alloc(sizeof(*statements_list));
|
struct list *statements_list = d3dcompiler_alloc(sizeof(*statements_list));
|
||||||
|
|
||||||
|
@ -892,9 +891,8 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers,
|
||||||
|
|
||||||
load = new_var_load(var, var->loc);
|
load = new_var_load(var, var->loc);
|
||||||
list_add_tail(v->initializer.instrs, &load->node.entry);
|
list_add_tail(v->initializer.instrs, &load->node.entry);
|
||||||
assignment = make_assignment(&load->node, ASSIGN_OP_ASSIGN, v->initializer.args[0]);
|
add_assignment(v->initializer.instrs, &load->node, ASSIGN_OP_ASSIGN, v->initializer.args[0]);
|
||||||
d3dcompiler_free(v->initializer.args);
|
d3dcompiler_free(v->initializer.args);
|
||||||
list_add_tail(v->initializer.instrs, &assignment->entry);
|
|
||||||
|
|
||||||
if (modifiers & HLSL_STORAGE_STATIC)
|
if (modifiers & HLSL_STORAGE_STATIC)
|
||||||
list_move_tail(&hlsl_ctx.static_initializers, v->initializer.instrs);
|
list_move_tail(&hlsl_ctx.static_initializers, v->initializer.instrs);
|
||||||
|
@ -2722,24 +2720,24 @@ conditional_expr: logicor_expr
|
||||||
FIXME("ternary operator\n");
|
FIXME("ternary operator\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
assignment_expr: conditional_expr
|
assignment_expr:
|
||||||
{
|
|
||||||
$$ = $1;
|
|
||||||
}
|
|
||||||
| unary_expr assign_op assignment_expr
|
|
||||||
{
|
|
||||||
struct hlsl_ir_node *instr;
|
|
||||||
|
|
||||||
if (node_from_list($1)->data_type->modifiers & HLSL_MODIFIER_CONST)
|
conditional_expr
|
||||||
{
|
| unary_expr assign_op assignment_expr
|
||||||
hlsl_report_message(get_location(&@2), HLSL_LEVEL_ERROR, "l-value is const");
|
{
|
||||||
YYABORT;
|
struct hlsl_ir_node *lhs = node_from_list($1), *rhs = node_from_list($3);
|
||||||
}
|
|
||||||
if (!(instr = make_assignment(node_from_list($1), $2, node_from_list($3))))
|
if (lhs->data_type->modifiers & HLSL_MODIFIER_CONST)
|
||||||
YYABORT;
|
{
|
||||||
instr->loc = get_location(&@2);
|
hlsl_report_message(get_location(&@2), HLSL_LEVEL_ERROR, "l-value is const");
|
||||||
$$ = append_binop($3, $1, instr);
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
list_move_tail($3, $1);
|
||||||
|
d3dcompiler_free($1);
|
||||||
|
if (!add_assignment($3, lhs, $2, rhs))
|
||||||
|
YYABORT;
|
||||||
|
$$ = $3;
|
||||||
|
}
|
||||||
|
|
||||||
assign_op: '='
|
assign_op: '='
|
||||||
{
|
{
|
||||||
|
|
|
@ -1443,8 +1443,8 @@ static BOOL invert_swizzle(unsigned int *swizzle, unsigned int *writemask, unsig
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *lhs, enum parse_assign_op assign_op,
|
struct hlsl_ir_node *add_assignment(struct list *instrs, struct hlsl_ir_node *lhs,
|
||||||
struct hlsl_ir_node *rhs)
|
enum parse_assign_op assign_op, struct hlsl_ir_node *rhs)
|
||||||
{
|
{
|
||||||
struct hlsl_ir_assignment *assign = d3dcompiler_alloc(sizeof(*assign));
|
struct hlsl_ir_assignment *assign = d3dcompiler_alloc(sizeof(*assign));
|
||||||
struct hlsl_type *lhs_type;
|
struct hlsl_type *lhs_type;
|
||||||
|
@ -1524,6 +1524,7 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *lhs, enum parse_assign
|
||||||
rhs = expr;
|
rhs = expr;
|
||||||
}
|
}
|
||||||
assign->rhs = rhs;
|
assign->rhs = rhs;
|
||||||
|
list_add_tail(instrs, &assign->node.entry);
|
||||||
|
|
||||||
return &assign->node;
|
return &assign->node;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue