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

Author: Kenneth Graunke <kenn...@whitecape.org>
Date:   Wed May 18 09:31:49 2016 -0700

nir: Make nir_lower_wpos_ytransform() match FragCoord by location.

gl_FragCoord is a shader input with location == VARYING_SLOT_POS.
ARB_fragment_programs have an equivalent input at VARYING_SLOT_POS,
but it isn't called gl_FragCoord.  We do want to transform it.

Matching by location guarantees we catch both.

Fixes several fp tests on a branch which uses this pass on i965.

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
Reviewed-by: Rob Clark <robdcl...@gmail.com>

---

 src/compiler/nir/nir_lower_wpos_ytransform.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_lower_wpos_ytransform.c 
b/src/compiler/nir/nir_lower_wpos_ytransform.c
index 4dc9d95..c437b3a 100644
--- a/src/compiler/nir/nir_lower_wpos_ytransform.c
+++ b/src/compiler/nir/nir_lower_wpos_ytransform.c
@@ -286,7 +286,8 @@ lower_wpos_ytransform_block(lower_wpos_ytransform_state 
*state, nir_block *block
             nir_deref_var *dvar = intr->variables[0];
             nir_variable *var = dvar->var;
 
-            if (strcmp(var->name, "gl_FragCoord") == 0) {
+            if (var->data.mode == nir_var_shader_in &&
+                var->data.location == VARYING_SLOT_POS) {
                /* gl_FragCoord should not have array/struct deref's: */
                assert(dvar->deref.child == NULL);
                lower_fragcoord(state, intr);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to