vkd3d-shader/hlsl: Do not collect expressions across different operations in hlsl_normalize_binary_exprs().

This commit is contained in:
Henri Verbeet
2025-03-08 16:59:58 +01:00
parent b4296e1a2d
commit b9ebf87114
Notes: Henri Verbeet 2025-03-12 22:21:01 +01:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1411
2 changed files with 7 additions and 5 deletions

View File

@@ -1712,7 +1712,8 @@ bool hlsl_normalize_binary_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst
progress = true;
}
if (!progress && e1 && (tmp = collect_exprs(ctx, &block, instr, op, e1->operands[1].node, arg2)))
if (!progress && e1 && e1->op == op
&& (tmp = collect_exprs(ctx, &block, instr, op, e1->operands[1].node, arg2)))
{
/* (y OPR (x OPL a)) OPR (x OPL b) -> y OPR (x OPL (a OPR b)) */
arg1 = e1->operands[0].node;
@@ -1720,7 +1721,7 @@ bool hlsl_normalize_binary_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst
progress = true;
}
if (!progress && is_op_commutative(op) && e1
if (!progress && is_op_commutative(op) && e1 && e1->op == op
&& (tmp = collect_exprs(ctx, &block, instr, op, e1->operands[0].node, arg2)))
{
/* ((x OPL a) OPR y) OPR (x OPL b) -> (x OPL (a OPR b)) OPR y */
@@ -1729,7 +1730,8 @@ bool hlsl_normalize_binary_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst
progress = true;
}
if (!progress && e2 && (tmp = collect_exprs(ctx, &block, instr, op, arg1, e2->operands[0].node)))
if (!progress && e2 && e2->op == op
&& (tmp = collect_exprs(ctx, &block, instr, op, arg1, e2->operands[0].node)))
{
/* (x OPL a) OPR ((x OPL b) OPR y) -> (x OPL (a OPR b)) OPR y */
arg1 = tmp;
@@ -1737,7 +1739,7 @@ bool hlsl_normalize_binary_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst
progress = true;
}
if (!progress && is_op_commutative(op) && e2
if (!progress && is_op_commutative(op) && e2 && e2->op == op
&& (tmp = collect_exprs(ctx, &block, instr, op, arg1, e2->operands[1].node)))
{
/* (x OPL a) OPR (y OPR (x OPL b)) -> (x OPL (a OPR b)) OPR y */

View File

@@ -107,7 +107,7 @@ uint4 main() : SV_TARGET
[test]
uniform 0 uint4 0xccaa5533 7 1 2
todo(glsl | msl) draw quad
todo(sm<6) probe (0, 0) rgbaui(0xff77, 0xf, 0x407f, 0x9)
probe (0, 0) rgbaui(0xff77, 0xf, 0x407f, 0x9)
[require]
shader model >= 6.2