Commit Graph

72 Commits

Author SHA1 Message Date
Zebediah Figura
2480eec98b vkd3d-shader/hlsl: Move the "base_type" member to the class-specific union. 2024-05-06 22:12:41 +02:00
Francisco Casas
ee735e8eed vkd3d-shader/hlsl: Fold x * 1 identities. 2024-04-30 16:31:05 +02:00
Francisco Casas
b14f935d0f vkd3d-shader/hlsl: Fold x + 0 identities. 2024-04-30 16:31:02 +02:00
Francisco Casas
19fd43214b vkd3d-shader/hlsl: Ensure that TERNARY condition is always bool.
Also, properly casting it to float in lower_ternary() for SM1
avoids creating ABS and NEG on bool types.
2024-04-09 12:26:59 -05:00
Nikolay Sivov
4778d051df vkd3d-shader: Add constant folding for 'floor'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:40 +01:00
Nikolay Sivov
955932fb55 vkd3d-shader: Add constant folding for 'ceil'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:40 +01:00
Nikolay Sivov
f3389789b2 vkd3d-shader: Add constant folding for 'rsq'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:16:03 +02:00
Nikolay Sivov
a58c659b10 vkd3d-shader/hlsl: Add constant folding for binary complement operator.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:56 +02:00
Nikolay Sivov
8ebccad3c9 vkd3d-shader/hlsl: Add constant folding for rshift.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:54 +02:00
Nikolay Sivov
6e74819eb7 vkd3d-shader/hlsl: Add constant folding for lshift.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:52 +02:00
Nikolay Sivov
8c9d65d6b3 vkd3d-shader/hlsl: Add constant folding for logical 'not', for bools.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:50 +02:00
Nikolay Sivov
485cbe8cb7 vkd3d-shader/hlsl: Add constant folding for 'sat'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:35 +02:00
Nikolay Sivov
89c99cccce vkd3d-shader/hlsl: Add constant folding for 'exp2'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:34 +02:00
Nikolay Sivov
c16c5caad8 vkd3d-shader/hlsl: Add constant folding for 'fract'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:33 +02:00
Giovanni Mascellani
c69562128a vkd3d-shader/hlsl: Correctly fold casts from double. 2023-09-22 11:06:29 +02:00
Giovanni Mascellani
49bbd98a04 vkd3d-shader/hlsl: Correctly fold casts from float.
I.e., without invoking undefined behavior in the compiler. The rules
are desumed from the the MSDN documentation for ftoi and ftou.
2023-09-22 11:06:28 +02:00
Nikolay Sivov
d9c984c11a vkd3d-shader/hlsl: Add constant folding for the ternary operator.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:23 +02:00
Nikolay Sivov
98f63c46f8 vkd3d-shader/hlsl: Use type width in fold_rcp().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:21 +02:00
Nikolay Sivov
932c5e36dc vkd3d-shader/hlsl: Add constant folding for 'log2'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:20 +02:00
Nikolay Sivov
58bc61e48d vkd3d-shader/hlsl: Add constant folding for 'sqrt'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:18 +02:00
Nikolay Sivov
7e99188dc7 vkd3d-shader: Add constant folding for 'dp2add' operation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:15 +02:00
Nikolay Sivov
25ff56769b vkd3d-shader: Add constant folding for the 'dot' operation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:15 +02:00
Zebediah Figura
717cd3f5bb vkd3d-shader/hlsl: Consistently use the destination width in constant folding instructions (Valgrind). 2023-07-04 22:40:06 +02:00
Nikolay Sivov
300f3462a4 vkd3d-shader/hlsl: Add constant folding for 'rcp'. 2023-07-04 22:39:36 +02:00
Giovanni Mascellani
bdfec4886d vkd3d-shader/hlsl: Fold logical expressions. 2023-06-27 22:34:33 +02:00
Giovanni Mascellani
5a05fabe62 vkd3d-shader/hlsl: Fold floating point minimum expressions. 2023-06-27 22:34:30 +02:00
Giovanni Mascellani
2a2943c2cf vkd3d-shader/hlsl: Fold floating point maximum expressions. 2023-06-27 22:34:29 +02:00
Giovanni Mascellani
358d656262 vkd3d-shader/hlsl: Fold greater-than-or-equal comparisons. 2023-06-27 22:34:28 +02:00
Giovanni Mascellani
bf452b5907 vkd3d-shader/hlsl: Fold less-than comparisons. 2023-06-27 22:34:27 +02:00
Giovanni Mascellani
488af14144 vkd3d-shader/hlsl: Fold equality comparisons. 2023-06-27 22:34:25 +02:00
Giovanni Mascellani
6c9f6d0fcf vkd3d-shader/hlsl: Sort constant folding helpers alphabetically. 2023-06-27 22:34:24 +02:00
Zebediah Figura
f34b107faf vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_constant(). 2023-06-08 18:50:35 +02:00
Zebediah Figura
740b0ad807 vkd3d-shader/hlsl: Pass a hlsl_constant_value pointer to hlsl_new_constant(). 2023-06-08 18:50:34 +02:00
Zebediah Figura
79f443d131 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_bit_or(). 2023-06-08 18:50:32 +02:00
Zebediah Figura
1049f489bb vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_bit_and(). 2023-06-08 18:50:31 +02:00
Zebediah Figura
a7a09ac5ef vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_bit_xor(). 2023-06-08 18:50:30 +02:00
Zebediah Figura
b453a0acd6 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_abs(). 2023-05-26 19:11:46 +02:00
Zebediah Figura
c805eb1191 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_min(). 2023-05-26 19:11:44 +02:00
Zebediah Figura
aa82f61ef3 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_max(). 2023-05-26 19:11:42 +02:00
Zebediah Figura
ad0ab664d2 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_mod(). 2023-05-26 19:11:39 +02:00
Zebediah Figura
c8b7dbebe4 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_div(). 2023-05-26 19:11:36 +02:00
Zebediah Figura
855bb71f6d vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_nequal(). 2023-05-23 21:08:22 +02:00
Zebediah Figura
d565caafb5 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_mul(). 2023-05-23 21:08:21 +02:00
Zebediah Figura
623cd94997 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_add(). 2023-05-23 21:08:20 +02:00
Zebediah Figura
7d9b24fe11 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_neg(). 2023-05-23 21:08:19 +02:00
Zebediah Figura
eb04829e66 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_cast(). 2023-05-23 21:08:17 +02:00
Ethan Lee
fb9328d030 vkd3d-shader/hlsl: Fold constant integral abs().
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-22 22:03:18 +02:00
Zebediah Figura
0a44e6043e vkd3d-shader/hlsl: Put the hlsl_ir_constant value in a structure. 2023-05-01 22:18:33 +02:00
Zebediah Figura
7a9e393ea0 vkd3d-shader/hlsl: Rename the "type" field of struct hlsl_type to "class".
To be consistent with enum hlsl_type_class and HLSL_CLASS_*.
2023-04-03 17:59:24 +02:00
Zebediah Figura
8fd30aa87d vkd3d-shader/hlsl: Add some swizzle manipulation definitions. 2023-01-24 18:10:39 +01:00