Mesa (master): pan/midgard: Set Z to shadow comparator for 2D

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 17 18:15:49 UTC 2019


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Mon Dec 16 17:14:04 2019 -0500

pan/midgard: Set Z to shadow comparator for 2D

We still need to generalize for other types of (non-2D / array) shadow
samplers, but this is enough for sampler2DShadow to work with initial
dEQP tests passing.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3125>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3125>

---

 src/panfrost/midgard/midgard_compile.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index c28a69a4291..e2a6cef1433 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -1731,7 +1731,10 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
 
         /* We may need a temporary for the coordinate */
 
-        bool needs_temp_coord = (midgard_texop == TEXTURE_OP_TEXEL_FETCH);
+        bool needs_temp_coord =
+                (midgard_texop == TEXTURE_OP_TEXEL_FETCH) ||
+                (instr->is_shadow);
+
         unsigned coords = needs_temp_coord ? make_compiler_temp_reg(ctx) : 0;
 
         for (unsigned i = 0; i < instr->num_srcs; ++i) {
@@ -1795,7 +1798,8 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
                                         ins.swizzle[1][2] = COMPONENT_Z;
                                         ins.swizzle[1][3] = COMPONENT_Z;
                                 } else if (nr_components == 2) {
-                                        ins.swizzle[1][2] = COMPONENT_X;
+                                        ins.swizzle[1][2] =
+                                                instr->is_shadow ? COMPONENT_Z : COMPONENT_X;
                                         ins.swizzle[1][3] = COMPONENT_X;
                                 } else
                                         unreachable("Invalid texture 2D components");
@@ -1819,6 +1823,21 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
                         break;
                 };
 
+                case nir_tex_src_comparator: {
+                        /* TODO: generalize */
+                        unsigned comp = COMPONENT_Z;
+
+                        /* mov coord_temp.foo, coords */
+                        midgard_instruction mov = v_mov(index, coords);
+                        mov.mask = 1 << comp;
+
+                        for (unsigned i = 0; i < MIR_VEC_COMPONENTS; ++i)
+                                mov.swizzle[1][i] = COMPONENT_X;
+
+                        emit_mir_instruction(ctx, mov);
+                        break;
+                }
+
                 default:
                         unreachable("Unknown texture source type\n");
                 }




More information about the mesa-commit mailing list