From: Giovanni Mascellani gmascellani@codeweavers.com
--- libs/vkd3d-shader/hlsl.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 04e681a9..1b5ae172 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -550,9 +550,16 @@ enum hlsl_ir_expr_op HLSL_OP2_NEQUAL, HLSL_OP2_RSHIFT,
+ /* DP2ADD(a, b, c) computes the scalar product of a.xy and b.xy, + * then adds c. */ HLSL_OP3_DP2ADD, + /* LERP(a, b, c) computes a * (1-z) + b * z or, equivalently, + * a + z * (b - c). */ HLSL_OP3_LERP, - /* TERNARY is used specifically for ternary operator, and later lowered according to profile to e.g. MOVC. */ + /* MOVC(a, b, c) returns c is a is bitwise zero and b + * otherwise. TERNARY(a, b, c) returns c if a == 0 and y + * otherwise. They differ for floating point numbers, because + * -0.0 == 0.0, but it is not bitwise zero. */ HLSL_OP3_MOVC, HLSL_OP3_TERNARY, };
Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl.h:
HLSL_OP2_NEQUAL, HLSL_OP2_RSHIFT,
- /* DP2ADD(a, b, c) computes the scalar product of a.xy and b.xy,
HLSL_OP3_DP2ADD,* then adds c. */
- /* LERP(a, b, c) computes a * (1-z) + b * z or, equivalently,
* a + z * (b - c). */
I think we can get rid of LERP. We don't use it and I don't anticipate we're going to.
sm1 has an opcode "lrp", but I can't get the native compiler to generate it. Probably it's meant for assembly only. We may be safest not generating it in that case, although I'm not really sure.
Frankly, even if we do output it, we may want that to be a raising pass on the vsir.
Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl.h:
HLSL_OP2_NEQUAL, HLSL_OP2_RSHIFT,
- /* DP2ADD(a, b, c) computes the scalar product of a.xy and b.xy,
HLSL_OP3_DP2ADD,* then adds c. */
- /* LERP(a, b, c) computes a * (1-z) + b * z or, equivalently,
HLSL_OP3_LERP,* a + z * (b - c). */
- /* TERNARY is used specifically for ternary operator, and later lowered according to profile to e.g. MOVC. */
- /* MOVC(a, b, c) returns c is a is bitwise zero and b
Typographical error, "is a is".
On Tue Sep 12 16:36:06 2023 +0000, Zebediah Figura wrote:
I think we can get rid of LERP. We don't use it and I don't anticipate we're going to. sm1 has an opcode "lrp", but I can't get the native compiler to generate it. Probably it's meant for assembly only. We may be safest not generating it in that case, although I'm not really sure. Frankly, even if we do output it, we may want that to be a raising pass on the vsir.
I thought about removing it too, but decided to leave it on blind trust towards who originally introduced it. It seems that removing is the best option, though.