From 588acdb431ff672394b5d488d7cdbd7b3f42adf2 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 25 Jun 2015 17:32:25 -0700 Subject: [PATCH] nir/spirv: Set the right location for shader input/outputs We need to add FRAG_RESULT_DATA0 etc. to the input/output location. --- src/glsl/nir/spirv_to_nir.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c index 2dd3c42db03..d8523fd5a52 100644 --- a/src/glsl/nir/spirv_to_nir.c +++ b/src/glsl/nir/spirv_to_nir.c @@ -571,6 +571,17 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, vtn_foreach_decoration(b, val, var_decoration_cb, var); + if (b->execution_model == SpvExecutionModelFragment && + var->data.mode == nir_var_shader_out) { + var->data.location += FRAG_RESULT_DATA0; + } else if (b->execution_model == SpvExecutionModelVertex && + var->data.mode == nir_var_shader_in) { + var->data.location += VERT_ATTRIB_GENERIC0; + } else if (var->data.mode == nir_var_shader_in || + var->data.mode == nir_var_shader_out) { + var->data.location += VARYING_SLOT_VAR0; + } + switch (var->data.mode) { case nir_var_shader_in: exec_list_push_tail(&b->shader->inputs, &var->node); -- 2.30.2