Henri Verbeet pushed to branch master at wine / vkd3d
Commits: 2c9cf7c7 by Shaun Ren at 2024-12-11T15:32:22+01:00 vkd3d-shader/hlsl: Implement normalization of binary expressions.
We normalize binary expressions by attempting to group constants together, in order to facilitate further simplification of the expressions.
For any binary operator OP, non-constants x, y, and constants a, b, we apply the following rewrite rules:
a OP x -> x OP a, if OP is commutative.
(x OP a) OP b -> x OP (a OP b), if OP is associative.
(x OP a) OP y -> (x OP y) OP a, if OP is associative and commutative.
x OP (y OP a) -> (x OP y) OP a, if OP is associative.
Note that we consider floating point operations to be non-associative.
- - - - -
4 changed files:
- libs/vkd3d-shader/hlsl.h - libs/vkd3d-shader/hlsl_codegen.c - libs/vkd3d-shader/hlsl_constant_ops.c - tests/hlsl/arithmetic-uint.shader_test
View it on GitLab: https://gitlab.winehq.org/wine/vkd3d/-/commit/2c9cf7c78bb098559bb7d3eeb7dc7b...