[Mesa-dev] [PATCH 03/23] nir/lower_io: Switch on shader stage for inputs in load_op().
Kenneth Graunke
kenneth at whitecape.org
Wed Sep 30 00:58:07 PDT 2015
The next commit will introduce a new intrinsic for shaders which process
multiple vertices (i.e. geometry, tessellation). This plumbing allows
us to generate different intrinsics based on the shader stage.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/glsl/nir/nir_lower_io.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c
index 6072682..f027973 100644
--- a/src/glsl/nir/nir_lower_io.c
+++ b/src/glsl/nir/nir_lower_io.c
@@ -126,13 +126,23 @@ get_io_offset(nir_deref_var *deref, nir_instr *instr, nir_src *indirect,
}
static nir_intrinsic_op
-load_op(nir_variable_mode mode, bool has_indirect)
+load_op(struct lower_io_state *state,
+ nir_variable_mode mode, bool has_indirect)
{
nir_intrinsic_op op;
switch (mode) {
case nir_var_shader_in:
- op = has_indirect ? nir_intrinsic_load_input_indirect :
- nir_intrinsic_load_input;
+ switch (state->builder.shader->stage) {
+ case MESA_SHADER_VERTEX:
+ case MESA_SHADER_TESS_CTRL:
+ case MESA_SHADER_TESS_EVAL:
+ case MESA_SHADER_GEOMETRY:
+ case MESA_SHADER_FRAGMENT:
+ case MESA_SHADER_COMPUTE:
+ op = has_indirect ? nir_intrinsic_load_input_indirect :
+ nir_intrinsic_load_input;
+ break;
+ }
break;
case nir_var_uniform:
op = has_indirect ? nir_intrinsic_load_uniform_indirect :
@@ -173,7 +183,7 @@ nir_lower_io_block(nir_block *block, void *void_state)
nir_intrinsic_instr *load =
nir_intrinsic_instr_create(state->mem_ctx,
- load_op(mode, has_indirect));
+ load_op(state, mode, has_indirect));
load->num_components = intrin->num_components;
nir_src indirect;
--
2.5.3
More information about the mesa-dev
mailing list