d3dcompiler: Parse multiplicative expressions.
This commit is contained in:
parent
7293c1c0fe
commit
57a7479f77
|
@ -974,6 +974,12 @@ BOOL find_function(const char *name) DECLSPEC_HIDDEN;
|
|||
unsigned int components_count_type(struct hlsl_type *type) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *new_expr(enum hlsl_ir_expr_op op, struct hlsl_ir_node **operands,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_mul(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_div(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_mod(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_add(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_sub(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
|
|
|
@ -967,6 +967,27 @@ mul_expr: unary_expr
|
|||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| mul_expr '*' unary_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_mul($1, $3, &loc)->node;
|
||||
}
|
||||
| mul_expr '/' unary_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_div($1, $3, &loc)->node;
|
||||
}
|
||||
| mul_expr '%' unary_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_mod($1, $3, &loc)->node;
|
||||
}
|
||||
|
||||
add_expr: mul_expr
|
||||
{
|
||||
|
|
|
@ -1181,6 +1181,45 @@ struct hlsl_ir_expr *new_expr(enum hlsl_ir_expr_op op, struct hlsl_ir_node **ope
|
|||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_mul(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_MUL, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_div(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_DIV, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_mod(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_MOD, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_add(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue