Module: Mesa
Branch: main
Commit: 6848e05f9c2ee8a004796e0b069c81a16ef1c301
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6848e05f9c2ee8a004796e0b069c81a16ef1c301

Author: Qiang Yu <[email protected]>
Date:   Fri Feb 24 13:57:33 2023 +0800

nir: pack_(s|u)norm_2x16 support float16 as input

For AMD GPU which has instruction to normalize and pack two float16
inputs, and used when fragment shader export color output.

Reviewed-by: Marek Olšák <[email protected]>
Signed-off-by: Qiang Yu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21552>

---

 src/compiler/nir/nir_opcodes.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index 0b2c8c40210..bc263806c18 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -328,8 +328,8 @@ unop("fddy_coarse", tfloat, "0.0")
 
 # Floating point pack and unpack operations.
 
-def pack_2x16(fmt):
-   unop_horiz("pack_" + fmt + "_2x16", 1, tuint32, 2, tfloat32, """
+def pack_2x16(fmt, in_type):
+   unop_horiz("pack_" + fmt + "_2x16", 1, tuint32, 2, in_type, """
 dst.x = (uint32_t) pack_fmt_1x16(src0.x);
 dst.x |= ((uint32_t) pack_fmt_1x16(src0.y)) << 16;
 """.replace("fmt", fmt))
@@ -357,11 +357,11 @@ dst.w = unpack_fmt_1x8((uint8_t)(src0.x >> 24));
 """.replace("fmt", fmt))
 
 
-pack_2x16("snorm")
+pack_2x16("snorm", tfloat)
 pack_4x8("snorm")
-pack_2x16("unorm")
+pack_2x16("unorm", tfloat)
 pack_4x8("unorm")
-pack_2x16("half")
+pack_2x16("half", tfloat32)
 unpack_2x16("snorm")
 unpack_4x8("snorm")
 unpack_2x16("unorm")

Reply via email to