nir: Only do gl_FrontFacing workaround in glsl_to_nir for the FS.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 6 Mar 2015 09:24:30 +0000 (01:24 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 9 Mar 2015 03:04:02 +0000 (20:04 -0700)
Vertex shaders can have shader inputs where location happens to be
VARYING_SLOT_FACE.  Without predicating this on the shader stage,
we suddenly end up with load_front_face intrinsics in vertex shaders,
which is nonsensical.

Fixes spec/arb_vertex_buffer_object/pos-array when using NIR for VS.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/glsl/nir/glsl_to_nir.cpp

index ddad207232ea7678252f810b2a1ed257ea061581..047cb51e85d93ff9470269e520dbbf5ebeae4ce8 100644 (file)
@@ -251,7 +251,8 @@ nir_visitor::visit(ir_variable *ir)
       break;
 
    case ir_var_shader_in:
-      if (ir->data.location == VARYING_SLOT_FACE) {
+      if (stage == MESA_SHADER_FRAGMENT &&
+          ir->data.location == VARYING_SLOT_FACE) {
          /* For whatever reason, GLSL IR makes gl_FrontFacing an input */
          var->data.location = SYSTEM_VALUE_FRONT_FACE;
          var->data.mode = nir_var_system_value;