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.
This commit is contained in:
Francisco Casas
2024-03-01 16:01:03 -03:00
committed by Alexandre Julliard
parent 9c0d04c862
commit 19fd43214b
Notes: Alexandre Julliard 2024-04-09 15:44:37 -05:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/744
11 changed files with 114 additions and 122 deletions

View File

@@ -601,12 +601,10 @@ enum hlsl_ir_expr_op
/* DP2ADD(a, b, c) computes the scalar product of a.xy and b.xy,
* then adds c. */
HLSL_OP3_DP2ADD,
/* MOVC(a, b, c) returns c if a is bitwise zero and b otherwise.
* TERNARY(a, b, c) returns c if a == 0 and b otherwise.
* They differ for floating point numbers, because
* -0.0 == 0.0, but it is not bitwise zero. CMP(a, b, c) returns b
if a >= 0, and c otherwise. It's used only for SM1-SM3 targets, while
SM4+ is using MOVC in such cases. */
/* TERNARY(a, b, c) returns 'b' if 'a' is true and 'c' otherwise. 'a' must always be boolean.
* MOVC(a, b, c) returns 'c' if 'a' is bitwise zero and 'b' otherwise.
* CMP(a, b, c) returns 'b' if 'a' >= 0, and 'c' otherwise. It's used only for SM1-SM3 targets,
while SM4+ is using MOVC in such cases. */
HLSL_OP3_CMP,
HLSL_OP3_MOVC,
HLSL_OP3_TERNARY,