Mesa (master): pan/bi: Implement sampler1D

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 25 13:26:48 UTC 2020


Module: Mesa
Branch: master
Commit: eee2a4346154570d6130a05e14afde59bad17a1f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eee2a4346154570d6130a05e14afde59bad17a1f

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Fri Nov 13 17:04:43 2020 -0500

pan/bi: Implement sampler1D

Enough to get shaders/humus-celshading/1.shader_test compiling, no idea
if it actually works but it looks reasonable.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7615>

---

 src/panfrost/bifrost/bifrost_compile.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 2e25bec482b..ef04cc03d7b 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -1965,15 +1965,22 @@ emit_texc(bi_context *ctx, nir_tex_instr *instr)
                                 texc_pack_cube_coord(ctx, index,
                                                      &tex.src[1], &tex.src[2]);
 			} else {
+                                unsigned components = nir_src_num_components(instr->src[i].src);
+
                                 tex.src[1] = index;
                                 tex.src[2] = index;
                                 tex.swizzle[1][0] = 0;
-                                tex.swizzle[2][0] = 1;
 
-                                unsigned components = nir_src_num_components(instr->src[i].src);
-                                assert(components == 2 || components == 3);
+                                if (components >= 2) {
+                                        tex.swizzle[2][0] = 1;
+                                } else {
+                                        /* Dummy for reg alloc to be happy */
+                                        tex.swizzle[2][0] = 0;
+                                }
+
+                                assert(components >= 1 && components <= 3);
 
-                                if (components == 2) {
+                                if (components < 3) {
                                         /* nothing to do */
                                 } else if (desc.array) {
                                         /* 2D array */



More information about the mesa-commit mailing list