Mesa (master): prog_to_nir: fix write from vps to FOG

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 8 18:35:34 UTC 2019


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

Author: Karol Herbst <kherbst at redhat.com>
Date:   Tue Feb 26 11:58:11 2019 +0100

prog_to_nir: fix write from vps to FOG

for fragment programs we already treat fog as a single component value,
but for vp we didn't.

Fixes fog related piglit tests with my out of tree Nouveau nir patches.

Signed-off-by: Karol Herbst <kherbst at redhat.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/program/prog_to_nir.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index aa4f2aaf72a..cb1c19e9dfa 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -867,6 +867,11 @@ ptn_add_output_stores(struct ptn_compile *c)
           */
          src = nir_channel(b, src, 2);
       }
+      if (c->prog->Target == GL_VERTEX_PROGRAM_ARB &&
+          var->data.location == VARYING_SLOT_FOGC) {
+         /* result.fogcoord is a single component value */
+         src = nir_channel(b, src, 0);
+      }
       unsigned num_components = glsl_get_vector_elements(var->type);
       nir_store_var(b, var, src, (1 << num_components) - 1);
    }
@@ -950,7 +955,8 @@ setup_registers_and_variables(struct ptn_compile *c)
       reg->num_components = 4;
 
       nir_variable *var = rzalloc(shader, nir_variable);
-      if (c->prog->Target == GL_FRAGMENT_PROGRAM_ARB && i == FRAG_RESULT_DEPTH)
+      if ((c->prog->Target == GL_FRAGMENT_PROGRAM_ARB && i == FRAG_RESULT_DEPTH) ||
+          (c->prog->Target == GL_VERTEX_PROGRAM_ARB && i == VARYING_SLOT_FOGC))
          var->type = glsl_float_type();
       else
          var->type = glsl_vec4_type();




More information about the mesa-commit mailing list