Mesa (master): i965/gs: Fixup gl_PointSize on entry to geometry shaders.

Paul Berry stereotype441 at kemper.freedesktop.org
Tue Oct 8 19:59:54 UTC 2013


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

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Fri Jul 12 20:17:13 2013 -0700

i965/gs: Fixup gl_PointSize on entry to geometry shaders.

gl_PointSize is stored in the w component of VARYING_SLOT_PSIZ, but
the geometry shader infrastructure assumes that it should look for all
geometry shader inputs of type float in the x component.  So when
compiling a geomtery shader that uses a gl_PointSize input, fix it up
during the shader prolog by moving the w component to the x component.

This is similar to how we emit fixups and workarounds for vertex
shader attributes.

Fixes piglit test spec/glsl-1.50/execution/geometry/core-inputs.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

---

 src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index 2d3a058..96636e8 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -156,6 +156,23 @@ vec4_gs_visitor::emit_prolog()
       }
    }
 
+   /* If the geometry shader uses the gl_PointSize input, we need to fix it up
+    * to account for the fact that the vertex shader stored it in the w
+    * component of VARYING_SLOT_PSIZ.
+    */
+   if (c->gp->program.Base.InputsRead & VARYING_BIT_PSIZ) {
+      this->current_annotation = "swizzle gl_PointSize input";
+      for (int vertex = 0; vertex < c->gp->program.VerticesIn; vertex++) {
+         dst_reg dst(ATTR,
+                     BRW_VARYING_SLOT_COUNT * vertex + VARYING_SLOT_PSIZ);
+         dst.type = BRW_REGISTER_TYPE_F;
+         src_reg src(dst);
+         dst.writemask = WRITEMASK_X;
+         src.swizzle = BRW_SWIZZLE_WWWW;
+         emit(MOV(dst, src));
+      }
+   }
+
    this->current_annotation = NULL;
 }
 




More information about the mesa-commit mailing list