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

Author: Alyssa Rosenzweig <[email protected]>
Date:   Mon Sep 27 17:15:38 2021 -0400

nir/lower_pntc_ytransform: Support PointCoordIsSysval

Pattern match the point coord sysval and support lowering it as well.
This is required to handle flipped framebuffers on Bifrost. However,
what this pass normalizes to is the opposite of the hardware mode we
used on Bifrost before, so we need to swap modes at the same time to
prevent regressions.

Fixes Piglit glsl-fs-pointcoord and glsl-fs-pointcoord_gles2

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13073>

---

 src/compiler/nir/nir_lower_pntc_ytransform.c | 6 ++++--
 src/panfrost/ci/panfrost-g52-fails.txt       | 3 ---
 src/panfrost/lib/pan_shader.h                | 4 ++++
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/compiler/nir/nir_lower_pntc_ytransform.c 
b/src/compiler/nir/nir_lower_pntc_ytransform.c
index 91dda527d1b..e7b12b4ec65 100644
--- a/src/compiler/nir/nir_lower_pntc_ytransform.c
+++ b/src/compiler/nir/nir_lower_pntc_ytransform.c
@@ -94,8 +94,10 @@ lower_pntc_ytransform_block(lower_pntc_ytransform_state 
*state,
             nir_deref_instr *deref = nir_src_as_deref(intr->src[0]);
             nir_variable *var = nir_deref_instr_get_variable(deref);
 
-            if (var->data.mode == nir_var_shader_in &&
-                var->data.location == VARYING_SLOT_PNTC) {
+            if ((var->data.mode == nir_var_shader_in &&
+                 var->data.location == VARYING_SLOT_PNTC) ||
+                (var->data.mode == nir_var_system_value &&
+                 var->data.location == SYSTEM_VALUE_POINT_COORD)) {
                 lower_load_pointcoord(state, intr);
             }
          }
diff --git a/src/panfrost/ci/panfrost-g52-fails.txt 
b/src/panfrost/ci/panfrost-g52-fails.txt
index 4b15631fb9a..de573803020 100644
--- a/src/panfrost/ci/panfrost-g52-fails.txt
+++ b/src/panfrost/ci/panfrost-g52-fails.txt
@@ -18,7 +18,6 @@ glx@glx-swap-pixmap-bad,Fail
 glx@glx-visuals-depth -pixmap,Crash
 glx@glx-visuals-stencil -pixmap,Crash
 shaders@glsl-bug-110796,Fail
-shaders@glsl-fs-pointcoord,Fail
 shaders@glsl-uniform-interstage-limits@subdivide 5,Crash
 shaders@glsl-uniform-interstage-limits@subdivide 5- statechanges,Crash
 shaders@glsl-vs-if-bool,Fail
@@ -101,7 +100,6 @@ spec@arb_fragment_program@sparse-samplers,Crash
 spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit depth 
gl_depth32f_stencil8,Fail
 spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit 
depth_stencil gl_depth32f_stencil8,Fail
 spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit stencil 
gl_depth32f_stencil8,Fail
-spec@arb_framebuffer_object@fbo-gl_pointcoord,Fail
 spec@arb_framebuffer_object@fbo-luminance-alpha,Fail
 spec@arb_framebuffer_srgb@fbo-fast-clear,Fail
 spec@arb_get_program_binary@restore-sso-program,Fail
@@ -1282,6 +1280,5 @@ spec@!opengl 3.1@primitive-restart-xfb generated,Fail
 spec@!opengl 3.1@primitive-restart-xfb written,Fail
 spec@!opengl 3.1@required-texture-attachment-formats,Fail
 spec@!opengl 3.2@coord-replace-doesnt-eliminate-frag-tex-coords,Fail
-spec@!opengl es 2.0@glsl-fs-pointcoord,Fail
 spec@!opengl es 3.0@ext_texture_array-compressed_gles3 texsubimage,Fail
 spec@!opengl es [email protected],Fail
diff --git a/src/panfrost/lib/pan_shader.h b/src/panfrost/lib/pan_shader.h
index 50867c46053..b975698be5c 100644
--- a/src/panfrost/lib/pan_shader.h
+++ b/src/panfrost/lib/pan_shader.h
@@ -142,6 +142,10 @@ pan_shader_prepare_bifrost_rsd(const struct 
pan_shader_info *info,
                 rsd->properties.shader_wait_dependency_7 = 
info->bifrost.wait_7;
 #endif
 
+                /* Match the mesa/st convention. If this needs to be flipped,
+                 * nir_lower_pntc_ytransform will do so. */
+                rsd->properties.point_sprite_coord_origin_max_y = true;
+
                 rsd->properties.allow_forward_pixel_to_be_killed =
                         !info->fs.sidefx;
 

Reply via email to