[Mesa-dev] [PATCH 1/4] nir/lower_io: Use load_per_vertex_input intrinsics for TCS and TES.

Kenneth Graunke kenneth at whitecape.org
Tue Nov 10 01:21:33 PST 2015


Tessellation control shader inputs are an array indexed by the vertex
number, like geometry shader inputs.  There aren't per-patch TCS inputs.

Tessellation evaluation shaders have both per-vertex and per-patch
inputs.  Per-vertex inputs get the new intrinsics; per-patch inputs
continue to use the ordinary load_input intrinsics, as they already
work like we want them to.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/nir/nir_lower_io.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c
index 688b48f..f04b9b8 100644
--- a/src/glsl/nir/nir_lower_io.c
+++ b/src/glsl/nir/nir_lower_io.c
@@ -71,7 +71,9 @@ static bool
 stage_uses_per_vertex_inputs(struct lower_io_state *state)
 {
    gl_shader_stage stage = state->builder.shader->stage;
-   return stage == MESA_SHADER_GEOMETRY;
+   return stage == MESA_SHADER_TESS_CTRL ||
+          stage == MESA_SHADER_TESS_EVAL ||
+          stage == MESA_SHADER_GEOMETRY;
 }
 
 static unsigned
@@ -185,7 +187,8 @@ nir_lower_io_block(nir_block *block, void *void_state)
             continue;
 
          bool per_vertex = stage_uses_per_vertex_inputs(state) &&
-                           mode == nir_var_shader_in;
+                           mode == nir_var_shader_in &&
+                           !intrin->variables[0]->var->data.patch;
 
          nir_ssa_def *indirect;
          nir_ssa_def *vertex_index;
-- 
2.6.2



More information about the mesa-dev mailing list