[PATCH vkd3d 2/5] vkd3d-shader: Rename hlsl_ir_expr_op members.

Zebediah Figura zfigura at codeweavers.com
Wed Aug 11 17:32:59 CDT 2021


For the sake of simplicity and clarity, especially in the interest of allowing
us to have expressions with larger numbers of terms.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
In specific, it is my plan to encode e.g. SampleGrad as HLSL_OP6_SAMPLE_GRAD.

 libs/vkd3d-shader/hlsl.c         |  92 ++++++++++++++--------------
 libs/vkd3d-shader/hlsl.h         | 101 ++++++++++++++-----------------
 libs/vkd3d-shader/hlsl.y         |  55 +++++++++--------
 libs/vkd3d-shader/hlsl_codegen.c |  20 +++---
 libs/vkd3d-shader/hlsl_sm1.c     |  20 +++---
 5 files changed, 138 insertions(+), 150 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index 9f50d2fc..62dc535d 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -439,7 +439,7 @@ struct hlsl_ir_expr *hlsl_new_cast(struct hlsl_ctx *ctx, struct hlsl_ir_node *no
 {
     struct hlsl_ir_node *cast;
 
-    cast = hlsl_new_unary_expr(ctx, HLSL_IR_UNOP_CAST, node, *loc);
+    cast = hlsl_new_unary_expr(ctx, HLSL_OP1_CAST, node, *loc);
     if (cast)
         cast->data_type = type;
     return hlsl_ir_expr(cast);
@@ -1035,51 +1035,51 @@ static const char *debug_expr_op(const struct hlsl_ir_expr *expr)
 {
     static const char *const op_names[] =
     {
-        [HLSL_IR_UNOP_ABS]          = "abs",
-        [HLSL_IR_UNOP_BIT_NOT]      = "~",
-        [HLSL_IR_UNOP_CAST]         = "cast",
-        [HLSL_IR_UNOP_COS]          = "cos",
-        [HLSL_IR_UNOP_COS_REDUCED]  = "cos_reduced",
-        [HLSL_IR_UNOP_DSX]          = "dsx",
-        [HLSL_IR_UNOP_DSY]          = "dsy",
-        [HLSL_IR_UNOP_EXP2]         = "exp2",
-        [HLSL_IR_UNOP_FRACT]        = "fract",
-        [HLSL_IR_UNOP_LOG2]         = "log2",
-        [HLSL_IR_UNOP_LOGIC_NOT]    = "!",
-        [HLSL_IR_UNOP_NEG]          = "-",
-        [HLSL_IR_UNOP_NRM]          = "nrm",
-        [HLSL_IR_UNOP_RCP]          = "rcp",
-        [HLSL_IR_UNOP_RSQ]          = "rsq",
-        [HLSL_IR_UNOP_SAT]          = "sat",
-        [HLSL_IR_UNOP_SIGN]         = "sign",
-        [HLSL_IR_UNOP_SIN]          = "sin",
-        [HLSL_IR_UNOP_SIN_REDUCED]  = "sin_reduced",
-        [HLSL_IR_UNOP_SQRT]         = "sqrt",
-
-        [HLSL_IR_BINOP_ADD]         = "+",
-        [HLSL_IR_BINOP_BIT_AND]     = "&",
-        [HLSL_IR_BINOP_BIT_OR]      = "|",
-        [HLSL_IR_BINOP_BIT_XOR]     = "^",
-        [HLSL_IR_BINOP_CRS]         = "crs",
-        [HLSL_IR_BINOP_DIV]         = "/",
-        [HLSL_IR_BINOP_DOT]         = "dot",
-        [HLSL_IR_BINOP_EQUAL]       = "==",
-        [HLSL_IR_BINOP_GEQUAL]      = ">=",
-        [HLSL_IR_BINOP_GREATER]     = ">",
-        [HLSL_IR_BINOP_LEQUAL]      = "<=",
-        [HLSL_IR_BINOP_LESS]        = "<",
-        [HLSL_IR_BINOP_LOGIC_AND]   = "&&",
-        [HLSL_IR_BINOP_LOGIC_OR]    = "||",
-        [HLSL_IR_BINOP_LSHIFT]      = "<<",
-        [HLSL_IR_BINOP_MAX]         = "max",
-        [HLSL_IR_BINOP_MIN]         = "min",
-        [HLSL_IR_BINOP_MOD]         = "%",
-        [HLSL_IR_BINOP_MUL]         = "*",
-        [HLSL_IR_BINOP_NEQUAL]      = "!=",
-        [HLSL_IR_BINOP_POW]         = "pow",
-        [HLSL_IR_BINOP_RSHIFT]      = ">>",
-
-        [HLSL_IR_TEROP_LERP]        = "lerp",
+        [HLSL_OP1_ABS]          = "abs",
+        [HLSL_OP1_BIT_NOT]      = "~",
+        [HLSL_OP1_CAST]         = "cast",
+        [HLSL_OP1_COS]          = "cos",
+        [HLSL_OP1_COS_REDUCED]  = "cos_reduced",
+        [HLSL_OP1_DSX]          = "dsx",
+        [HLSL_OP1_DSY]          = "dsy",
+        [HLSL_OP1_EXP2]         = "exp2",
+        [HLSL_OP1_FRACT]        = "fract",
+        [HLSL_OP1_LOG2]         = "log2",
+        [HLSL_OP1_LOGIC_NOT]    = "!",
+        [HLSL_OP1_NEG]          = "-",
+        [HLSL_OP1_NRM]          = "nrm",
+        [HLSL_OP1_RCP]          = "rcp",
+        [HLSL_OP1_RSQ]          = "rsq",
+        [HLSL_OP1_SAT]          = "sat",
+        [HLSL_OP1_SIGN]         = "sign",
+        [HLSL_OP1_SIN]          = "sin",
+        [HLSL_OP1_SIN_REDUCED]  = "sin_reduced",
+        [HLSL_OP1_SQRT]         = "sqrt",
+
+        [HLSL_OP2_ADD]         = "+",
+        [HLSL_OP2_BIT_AND]     = "&",
+        [HLSL_OP2_BIT_OR]      = "|",
+        [HLSL_OP2_BIT_XOR]     = "^",
+        [HLSL_OP2_CRS]         = "crs",
+        [HLSL_OP2_DIV]         = "/",
+        [HLSL_OP2_DOT]         = "dot",
+        [HLSL_OP2_EQUAL]       = "==",
+        [HLSL_OP2_GEQUAL]      = ">=",
+        [HLSL_OP2_GREATER]     = ">",
+        [HLSL_OP2_LEQUAL]      = "<=",
+        [HLSL_OP2_LESS]        = "<",
+        [HLSL_OP2_LOGIC_AND]   = "&&",
+        [HLSL_OP2_LOGIC_OR]    = "||",
+        [HLSL_OP2_LSHIFT]      = "<<",
+        [HLSL_OP2_MAX]         = "max",
+        [HLSL_OP2_MIN]         = "min",
+        [HLSL_OP2_MOD]         = "%",
+        [HLSL_OP2_MUL]         = "*",
+        [HLSL_OP2_NEQUAL]      = "!=",
+        [HLSL_OP2_POW]         = "pow",
+        [HLSL_OP2_RSHIFT]      = ">>",
+
+        [HLSL_OP3_LERP]        = "lerp",
     };
 
     return op_names[expr->op];
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index 3b0e5207..4a4af5d1 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -275,62 +275,51 @@ struct hlsl_ir_loop
 
 enum hlsl_ir_expr_op
 {
-    HLSL_IR_UNOP_BIT_NOT = 0,
-    HLSL_IR_UNOP_LOGIC_NOT,
-    HLSL_IR_UNOP_NEG,
-    HLSL_IR_UNOP_ABS,
-    HLSL_IR_UNOP_SIGN,
-    HLSL_IR_UNOP_RCP,
-    HLSL_IR_UNOP_RSQ,
-    HLSL_IR_UNOP_SQRT,
-    HLSL_IR_UNOP_NRM,
-    HLSL_IR_UNOP_EXP2,
-    HLSL_IR_UNOP_LOG2,
-
-    HLSL_IR_UNOP_CAST,
-
-    HLSL_IR_UNOP_FRACT,
-
-    HLSL_IR_UNOP_SIN,
-    HLSL_IR_UNOP_COS,
-    HLSL_IR_UNOP_SIN_REDUCED,    /* Reduced range [-pi, pi] */
-    HLSL_IR_UNOP_COS_REDUCED,    /* Reduced range [-pi, pi] */
-
-    HLSL_IR_UNOP_DSX,
-    HLSL_IR_UNOP_DSY,
-
-    HLSL_IR_UNOP_SAT,
-
-    HLSL_IR_BINOP_ADD,
-    HLSL_IR_BINOP_MUL,
-    HLSL_IR_BINOP_DIV,
-
-    HLSL_IR_BINOP_MOD,
-
-    HLSL_IR_BINOP_LESS,
-    HLSL_IR_BINOP_GREATER,
-    HLSL_IR_BINOP_LEQUAL,
-    HLSL_IR_BINOP_GEQUAL,
-    HLSL_IR_BINOP_EQUAL,
-    HLSL_IR_BINOP_NEQUAL,
-
-    HLSL_IR_BINOP_LOGIC_AND,
-    HLSL_IR_BINOP_LOGIC_OR,
-
-    HLSL_IR_BINOP_LSHIFT,
-    HLSL_IR_BINOP_RSHIFT,
-    HLSL_IR_BINOP_BIT_AND,
-    HLSL_IR_BINOP_BIT_OR,
-    HLSL_IR_BINOP_BIT_XOR,
-
-    HLSL_IR_BINOP_DOT,
-    HLSL_IR_BINOP_CRS,
-    HLSL_IR_BINOP_MIN,
-    HLSL_IR_BINOP_MAX,
-
-    HLSL_IR_BINOP_POW,
-
-    HLSL_IR_TEROP_LERP,
+    HLSL_OP1_ABS,
+    HLSL_OP1_BIT_NOT,
+    HLSL_OP1_CAST,
+    HLSL_OP1_COS,
+    HLSL_OP1_COS_REDUCED,    /* Reduced range [-pi, pi] */
+    HLSL_OP1_DSX,
+    HLSL_OP1_DSY,
+    HLSL_OP1_EXP2,
+    HLSL_OP1_FRACT,
+    HLSL_OP1_LOG2,
+    HLSL_OP1_LOGIC_NOT,
+    HLSL_OP1_NEG,
+    HLSL_OP1_NRM,
+    HLSL_OP1_RCP,
+    HLSL_OP1_RSQ,
+    HLSL_OP1_SAT,
+    HLSL_OP1_SIGN,
+    HLSL_OP1_SIN,
+    HLSL_OP1_SIN_REDUCED,    /* Reduced range [-pi, pi] */
+    HLSL_OP1_SQRT,
+
+    HLSL_OP2_ADD,
+    HLSL_OP2_BIT_AND,
+    HLSL_OP2_BIT_OR,
+    HLSL_OP2_BIT_XOR,
+    HLSL_OP2_CRS,
+    HLSL_OP2_DIV,
+    HLSL_OP2_DOT,
+    HLSL_OP2_EQUAL,
+    HLSL_OP2_GEQUAL,
+    HLSL_OP2_GREATER,
+    HLSL_OP2_LEQUAL,
+    HLSL_OP2_LESS,
+    HLSL_OP2_LOGIC_AND,
+    HLSL_OP2_LOGIC_OR,
+    HLSL_OP2_LSHIFT,
+    HLSL_OP2_MAX,
+    HLSL_OP2_MIN,
+    HLSL_OP2_MOD,
+    HLSL_OP2_MUL,
+    HLSL_OP2_NEQUAL,
+    HLSL_OP2_POW,
+    HLSL_OP2_RSHIFT,
+
+    HLSL_OP3_LERP,
 };
 
 struct hlsl_ir_expr
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 2754514d..ade78da6 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -324,7 +324,7 @@ static bool append_conditional_break(struct hlsl_ctx *ctx, struct list *cond_lis
         return true;
 
     condition = node_from_list(cond_list);
-    if (!(not = hlsl_new_unary_expr(ctx, HLSL_IR_UNOP_LOGIC_NOT, condition, condition->loc)))
+    if (!(not = hlsl_new_unary_expr(ctx, HLSL_OP1_LOGIC_NOT, condition, condition->loc)))
         return false;
     list_add_tail(cond_list, &not->entry);
 
@@ -535,7 +535,7 @@ static struct hlsl_ir_load *add_load(struct hlsl_ctx *ctx, struct list *instrs,
         var = src->var;
         if (src->offset.node)
         {
-            if (!(add = hlsl_new_binary_expr(ctx, HLSL_IR_BINOP_ADD, src->offset.node, offset)))
+            if (!(add = hlsl_new_binary_expr(ctx, HLSL_OP2_ADD, src->offset.node, offset)))
                 return NULL;
             list_add_tail(instrs, &add->entry);
             offset = add;
@@ -604,7 +604,7 @@ static struct hlsl_ir_load *add_array_load(struct hlsl_ctx *ctx, struct list *in
     if (!(c = hlsl_new_uint_constant(ctx, data_type->reg_size, loc)))
         return NULL;
     list_add_tail(instrs, &c->node.entry);
-    if (!(mul = hlsl_new_binary_expr(ctx, HLSL_IR_BINOP_MUL, index, &c->node)))
+    if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node)))
         return NULL;
     list_add_tail(instrs, &mul->entry);
     index = mul;
@@ -1117,16 +1117,16 @@ static enum hlsl_ir_expr_op op_from_assignment(enum parse_assign_op op)
     static const enum hlsl_ir_expr_op ops[] =
     {
         0,
-        HLSL_IR_BINOP_ADD,
+        HLSL_OP2_ADD,
         0,
-        HLSL_IR_BINOP_MUL,
-        HLSL_IR_BINOP_DIV,
-        HLSL_IR_BINOP_MOD,
-        HLSL_IR_BINOP_LSHIFT,
-        HLSL_IR_BINOP_RSHIFT,
-        HLSL_IR_BINOP_BIT_AND,
-        HLSL_IR_BINOP_BIT_OR,
-        HLSL_IR_BINOP_BIT_XOR,
+        HLSL_OP2_MUL,
+        HLSL_OP2_DIV,
+        HLSL_OP2_MOD,
+        HLSL_OP2_LSHIFT,
+        HLSL_OP2_RSHIFT,
+        HLSL_OP2_BIT_AND,
+        HLSL_OP2_BIT_OR,
+        HLSL_OP2_BIT_XOR,
     };
 
     return ops[op];
@@ -1181,7 +1181,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
         struct hlsl_ir_node *args[3] = {rhs};
         struct hlsl_ir_expr *expr;
 
-        if (!(expr = add_expr(ctx, instrs, HLSL_IR_UNOP_NEG, args, &rhs->loc)))
+        if (!(expr = add_expr(ctx, instrs, HLSL_OP1_NEG, args, &rhs->loc)))
             return NULL;
         rhs = &expr->node;
         assign_op = ASSIGN_OP_ADD;
@@ -1211,7 +1211,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
 
     while (lhs->type != HLSL_IR_LOAD)
     {
-        if (lhs->type == HLSL_IR_EXPR && hlsl_ir_expr(lhs)->op == HLSL_IR_UNOP_CAST)
+        if (lhs->type == HLSL_IR_EXPR && hlsl_ir_expr(lhs)->op == HLSL_OP1_CAST)
         {
             FIXME("Cast on the lhs.\n");
             vkd3d_free(store);
@@ -2835,8 +2835,7 @@ unary_expr:
         }
     | unary_op unary_expr
         {
-            enum hlsl_ir_expr_op ops[] = {0, HLSL_IR_UNOP_NEG,
-                    HLSL_IR_UNOP_LOGIC_NOT, HLSL_IR_UNOP_BIT_NOT};
+            static const enum hlsl_ir_expr_op ops[] = {0, HLSL_OP1_NEG, HLSL_OP1_LOGIC_NOT, HLSL_OP1_BIT_NOT};
 
             if ($1 == UNARY_OP_PLUS)
                 $$ = $2;
@@ -2901,31 +2900,31 @@ mul_expr:
       unary_expr
     | mul_expr '*' unary_expr
         {
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_MUL, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_MUL, @2);
         }
     | mul_expr '/' unary_expr
         {
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_DIV, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_DIV, @2);
         }
     | mul_expr '%' unary_expr
         {
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_MOD, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_MOD, @2);
         }
 
 add_expr:
       mul_expr
     | add_expr '+' mul_expr
         {
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_ADD, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_ADD, @2);
         }
     | add_expr '-' mul_expr
         {
             struct hlsl_ir_node *neg;
 
-            if (!(neg = hlsl_new_unary_expr(ctx, HLSL_IR_UNOP_NEG, node_from_list($3), @2)))
+            if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, node_from_list($3), @2)))
                 YYABORT;
             list_add_tail($3, &neg->entry);
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_ADD, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_ADD, @2);
         }
 
 shift_expr:
@@ -2943,30 +2942,30 @@ relational_expr:
       shift_expr
     | relational_expr '<' shift_expr
         {
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_LESS, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_LESS, @2);
         }
     | relational_expr '>' shift_expr
         {
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_GREATER, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_GREATER, @2);
         }
     | relational_expr OP_LE shift_expr
         {
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_LEQUAL, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_LEQUAL, @2);
         }
     | relational_expr OP_GE shift_expr
         {
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_GEQUAL, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_GEQUAL, @2);
         }
 
 equality_expr:
       relational_expr
     | equality_expr OP_EQ relational_expr
         {
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_EQUAL, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_EQUAL, @2);
         }
     | equality_expr OP_NE relational_expr
         {
-            $$ = add_binary_expr(ctx, $1, $3, HLSL_IR_BINOP_NEQUAL, @2);
+            $$ = add_binary_expr(ctx, $1, $3, HLSL_OP2_NEQUAL, @2);
         }
 
 bitand_expr:
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index 549636ca..5f23f345 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -250,7 +250,7 @@ static bool fold_redundant_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst
         const struct hlsl_type *src_type = expr->operands[0].node->data_type;
         const struct hlsl_type *dst_type = expr->node.data_type;
 
-        if (expr->op != HLSL_IR_UNOP_CAST)
+        if (expr->op != HLSL_OP1_CAST)
             return false;
 
         if (hlsl_types_are_equal(src_type, dst_type)
@@ -297,7 +297,7 @@ static bool split_struct_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
         offset = &c->node;
         if (rhs_load->src.offset.node)
         {
-            if (!(add = hlsl_new_binary_expr(ctx, HLSL_IR_BINOP_ADD, rhs_load->src.offset.node, &c->node)))
+            if (!(add = hlsl_new_binary_expr(ctx, HLSL_OP2_ADD, rhs_load->src.offset.node, &c->node)))
                 return false;
             list_add_before(&instr->entry, &add->entry);
             offset = add;
@@ -309,7 +309,7 @@ static bool split_struct_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
         offset = &c->node;
         if (store->lhs.offset.node)
         {
-            if (!(add = hlsl_new_binary_expr(ctx, HLSL_IR_BINOP_ADD, store->lhs.offset.node, &c->node)))
+            if (!(add = hlsl_new_binary_expr(ctx, HLSL_OP2_ADD, store->lhs.offset.node, &c->node)))
                 return false;
             list_add_before(&instr->entry, &add->entry);
             offset = add;
@@ -358,7 +358,7 @@ static bool fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, voi
         {
             switch (expr->op)
             {
-                case HLSL_IR_UNOP_CAST:
+                case HLSL_OP1_CAST:
                     if (instr->data_type->dimx != arg1->node.data_type->dimx
                             || instr->data_type->dimy != arg1->node.data_type->dimy)
                     {
@@ -400,17 +400,17 @@ static bool fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, voi
         {
             switch (expr->op)
             {
-                case HLSL_IR_UNOP_NEG:
+                case HLSL_OP1_NEG:
                     for (i = 0; i < instr->data_type->dimx; ++i)
                         res->value.u[i] = -arg1->value.u[i];
                     break;
 
-                case HLSL_IR_BINOP_ADD:
+                case HLSL_OP2_ADD:
                     for (i = 0; i < instr->data_type->dimx; ++i)
                         res->value.u[i] = arg1->value.u[i] + arg2->value.u[i];
                     break;
 
-                case HLSL_IR_BINOP_MUL:
+                case HLSL_OP2_MUL:
                     for (i = 0; i < instr->data_type->dimx; ++i)
                         res->value.u[i] = arg1->value.u[i] * arg2->value.u[i];
                     break;
@@ -443,13 +443,13 @@ static bool lower_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, voi
     if (instr->type != HLSL_IR_EXPR)
         return false;
     expr = hlsl_ir_expr(instr);
-    if (expr->op != HLSL_IR_BINOP_DIV)
+    if (expr->op != HLSL_OP2_DIV)
         return false;
 
-    if (!(rcp = hlsl_new_unary_expr(ctx, HLSL_IR_UNOP_RCP, expr->operands[1].node, instr->loc)))
+    if (!(rcp = hlsl_new_unary_expr(ctx, HLSL_OP1_RCP, expr->operands[1].node, instr->loc)))
         return false;
     list_add_before(&expr->node.entry, &rcp->entry);
-    expr->op = HLSL_IR_BINOP_MUL;
+    expr->op = HLSL_OP2_MUL;
     hlsl_src_remove(&expr->operands[1]);
     hlsl_src_from_node(&expr->operands[1], rcp);
     return true;
diff --git a/libs/vkd3d-shader/hlsl_sm1.c b/libs/vkd3d-shader/hlsl_sm1.c
index 8ea663dc..85d54ac2 100644
--- a/libs/vkd3d-shader/hlsl_sm1.c
+++ b/libs/vkd3d-shader/hlsl_sm1.c
@@ -612,19 +612,11 @@ static void write_sm1_expr(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
 
     switch (expr->op)
     {
-        case HLSL_IR_BINOP_ADD:
-            write_sm1_binary_op(ctx, buffer, D3DSIO_ADD, &instr->reg, &arg1->reg, &arg2->reg);
-            break;
-
-        case HLSL_IR_BINOP_MUL:
-            write_sm1_binary_op(ctx, buffer, D3DSIO_MUL, &instr->reg, &arg1->reg, &arg2->reg);
-            break;
-
-        case HLSL_IR_UNOP_NEG:
+        case HLSL_OP1_NEG:
             write_sm1_unary_op(ctx, buffer, D3DSIO_MOV, &instr->reg, &arg1->reg, D3DSPSM_NEG);
             break;
 
-        case HLSL_IR_UNOP_RCP:
+        case HLSL_OP1_RCP:
             for (i = 0; i < instr->data_type->dimx; ++i)
             {
                 struct hlsl_reg src = arg1->reg, dst = instr->reg;
@@ -635,6 +627,14 @@ static void write_sm1_expr(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
             }
             break;
 
+        case HLSL_OP2_ADD:
+            write_sm1_binary_op(ctx, buffer, D3DSIO_ADD, &instr->reg, &arg1->reg, &arg2->reg);
+            break;
+
+        case HLSL_OP2_MUL:
+            write_sm1_binary_op(ctx, buffer, D3DSIO_MUL, &instr->reg, &arg1->reg, &arg2->reg);
+            break;
+
         default:
             FIXME("Unhandled op %u.\n", expr->op);
             break;
-- 
2.32.0




More information about the wine-devel mailing list