i965/vec4/gs: Stop munging the ATTR containing gl_PointSize.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 14 Jan 2016 04:33:16 +0000 (20:33 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 10 Feb 2016 01:01:45 +0000 (17:01 -0800)
gl_PointSize is delivered in the .w component of the VUE header, while
the language expects it to be a float (and thus in the .x component).

Previously, we emitted MOVs to copy it over to the .x component.
But this is silly - we can just use a .wwww swizzle and access it
without copying anything or clobbering the value stored at .x
(which admittedly is useless).

Removes the last use of ATTR destinations.

v2: Use BRW_SWIZZLE_WWWW, not SWIZZLE_WWWW (caught by GCC).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp

index 6f66978f8e1d1bbedf154fa12ce0796efe1e33b1..d9c048e176476bc58387830d417bd252777db077 100644 (file)
@@ -73,6 +73,10 @@ vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
       src = src_reg(ATTR, BRW_VARYING_SLOT_COUNT * vertex->u[0] +
                           instr->const_index[0] + offset->u[0],
                     type);
+      /* gl_PointSize is passed in the .w component of the VUE header */
+      if (instr->const_index[0] == VARYING_SLOT_PSIZ)
+         src.swizzle = BRW_SWIZZLE_WWWW;
+
       dest = get_nir_dest(instr->dest, src.type);
       dest.writemask = brw_writemask_for_size(instr->num_components);
       emit(MOV(dest, src));
index b2a971a40ff00c3524926710001ed8c1df76d9ad..1b63d568d856a3152e1dab5f322fae6c96d27efb 100644 (file)
@@ -182,29 +182,6 @@ 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 (nir->info.inputs_read & VARYING_BIT_PSIZ) {
-      this->current_annotation = "swizzle gl_PointSize input";
-      for (int vertex = 0; vertex < (int)nir->info.gs.vertices_in; 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;
-         inst = emit(MOV(dst, src));
-
-         /* In dual instanced dispatch mode, dst has a width of 4, so we need
-          * to make sure the MOV happens regardless of which channels are
-          * enabled.
-          */
-         inst->force_writemask_all = true;
-      }
-   }
-
    this->current_annotation = NULL;
 }