[Mesa-dev] [PATCH 01/34] prog_to_nir: fix write from vps to PSIZ

Karol Herbst kherbst at redhat.com
Tue Mar 12 00:04:08 UTC 2019


Point size is a single component value and drivers might write the full vec4
potentially overwriting other values.

Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 src/mesa/program/prog_to_nir.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index cb1c19e9dfa..7d17e1da48a 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -868,7 +868,8 @@ 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) {
+          (var->data.location == VARYING_SLOT_FOGC ||
+           var->data.location == VARYING_SLOT_PSIZ)) {
          /* result.fogcoord is a single component value */
          src = nir_channel(b, src, 0);
       }
@@ -956,7 +957,8 @@ setup_registers_and_variables(struct ptn_compile *c)
 
       nir_variable *var = rzalloc(shader, nir_variable);
       if ((c->prog->Target == GL_FRAGMENT_PROGRAM_ARB && i == FRAG_RESULT_DEPTH) ||
-          (c->prog->Target == GL_VERTEX_PROGRAM_ARB && i == VARYING_SLOT_FOGC))
+          (c->prog->Target == GL_VERTEX_PROGRAM_ARB &&
+           (i == VARYING_SLOT_FOGC || i == VARYING_SLOT_PSIZ)))
          var->type = glsl_float_type();
       else
          var->type = glsl_vec4_type();
-- 
2.20.1



More information about the mesa-dev mailing list