diff options
Diffstat (limited to 'src/gallium/drivers/vc4')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_nir_lower_blend.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_nir_lower_io.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 19 |
3 files changed, 28 insertions, 10 deletions
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c index 808cbea8fde..f8c3c5f65bf 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c @@ -38,6 +38,7 @@ #include "util/u_format.h" #include "vc4_qir.h" #include "glsl/nir/nir_builder.h" +#include "nir/tgsi_to_nir.h" #include "vc4_context.h" /** Emits a load of the previous fragment color from the tile buffer. */ @@ -400,7 +401,10 @@ vc4_nir_lower_blend_block(nir_block *block, void *state) } } assert(output_var); - unsigned semantic_name = output_var->data.location; + unsigned semantic_name, semantic_index; + + varying_slot_to_tgsi_semantic(output_var->data.location, + &semantic_name, &semantic_index); if (semantic_name != TGSI_SEMANTIC_COLOR) continue; diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c index c401415fda7..31ac64b0f7a 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c @@ -22,6 +22,7 @@ */ #include "vc4_qir.h" +#include "nir/tgsi_to_nir.h" #include "tgsi/tgsi_info.h" #include "glsl/nir/nir_builder.h" @@ -71,8 +72,11 @@ vc4_nir_lower_input(struct vc4_compile *c, nir_builder *b, } } assert(input_var); - int semantic_name = input_var->data.location; - int semantic_index = input_var->data.index; + unsigned semantic_name, semantic_index; + + varying_slot_to_tgsi_semantic(input_var->data.location, + &semantic_name, &semantic_index); + /* All TGSI-to-NIR inputs are vec4. */ assert(intr->num_components == 4); @@ -141,7 +145,10 @@ vc4_nir_lower_output(struct vc4_compile *c, nir_builder *b, } } assert(output_var); - unsigned semantic_name = output_var->data.location; + unsigned semantic_name, semantic_index; + + varying_slot_to_tgsi_semantic(output_var->data.location, + &semantic_name, &semantic_index); if (c->stage == QSTAGE_COORD && (semantic_name != TGSI_SEMANTIC_POSITION && diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index e002983fdbb..7d59a2f0702 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -1412,11 +1412,12 @@ ntq_setup_inputs(struct vc4_compile *c) for (unsigned i = 0; i < num_entries; i++) { nir_variable *var = vars[i]; unsigned array_len = MAX2(glsl_get_length(var->type), 1); - /* XXX: map loc slots to semantics */ - unsigned semantic_name = var->data.location; - unsigned semantic_index = var->data.index; + unsigned semantic_name, semantic_index; unsigned loc = var->data.driver_location; + varying_slot_to_tgsi_semantic(var->data.location, + &semantic_name, &semantic_index); + assert(array_len == 1); (void)array_len; resize_qreg_array(c, &c->inputs, &c->inputs_array_size, @@ -1448,11 +1449,17 @@ ntq_setup_outputs(struct vc4_compile *c) { foreach_list_typed(nir_variable, var, node, &c->s->outputs) { unsigned array_len = MAX2(glsl_get_length(var->type), 1); - /* XXX: map loc slots to semantics */ - unsigned semantic_name = var->data.location; - unsigned semantic_index = var->data.index; + unsigned semantic_name, semantic_index; unsigned loc = var->data.driver_location * 4; + if (c->stage == QSTAGE_FRAG) { + frag_result_to_tgsi_semantic(var->data.location, + &semantic_name, &semantic_index); + } else { + varying_slot_to_tgsi_semantic(var->data.location, + &semantic_name, &semantic_index); + } + assert(array_len == 1); (void)array_len; |