From 7b3316f3c9930c1991fbb512897d77001644bfa5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timur=20Krist=C3=B3f?= Date: Wed, 12 Feb 2020 14:23:17 +0100 Subject: [PATCH] aco: Extract setup_gs_variables into a separate function. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Timur Kristóf Reviewed-by: Rhys Perry Part-of: --- .../aco_instruction_selection_setup.cpp | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/amd/compiler/aco_instruction_selection_setup.cpp b/src/amd/compiler/aco_instruction_selection_setup.cpp index b3c7ff059ad..9a58a2a955a 100644 --- a/src/amd/compiler/aco_instruction_selection_setup.cpp +++ b/src/amd/compiler/aco_instruction_selection_setup.cpp @@ -753,6 +753,27 @@ setup_vs_variables(isel_context *ctx, nir_shader *nir) } } +void setup_gs_variables(isel_context *ctx, nir_shader *nir) +{ + assert(ctx->stage == vertex_geometry_gs || ctx->stage == geometry_gs); + if (ctx->stage == vertex_geometry_gs) { + nir_foreach_variable(variable, &nir->inputs) { + variable->data.driver_location = util_bitcount64(ctx->input_masks[nir->info.stage] & ((1ull << variable->data.location) - 1ull)) * 4; + } + } else { + //TODO: make this more compact + nir_foreach_variable(variable, &nir->inputs) { + variable->data.driver_location = shader_io_get_unique_index((gl_varying_slot)variable->data.location) * 4; + } + } + nir_foreach_variable(variable, &nir->outputs) { + variable->data.driver_location = variable->data.location * 4; + } + + if (ctx->stage == vertex_geometry_gs) + ctx->program->info->gs.es_type = MESA_SHADER_VERTEX; /* tesselation shaders are not yet supported */ +} + void setup_variables(isel_context *ctx, nir_shader *nir) { @@ -775,22 +796,7 @@ setup_variables(isel_context *ctx, nir_shader *nir) break; } case MESA_SHADER_GEOMETRY: { - assert(ctx->stage == vertex_geometry_gs || ctx->stage == geometry_gs); - if (ctx->stage == vertex_geometry_gs) { - nir_foreach_variable(variable, &nir->inputs) { - variable->data.driver_location = util_bitcount64(ctx->input_masks[nir->info.stage] & ((1ull << variable->data.location) - 1ull)) * 4; - } - } else { - //TODO: make this more compact - nir_foreach_variable(variable, &nir->inputs) { - variable->data.driver_location = shader_io_get_unique_index((gl_varying_slot)variable->data.location) * 4; - } - } - nir_foreach_variable(variable, &nir->outputs) { - variable->data.driver_location = variable->data.location * 4; - } - if (ctx->stage == vertex_geometry_gs) - ctx->program->info->gs.es_type = MESA_SHADER_VERTEX; /* tesselation shaders are not yet supported */ + setup_gs_variables(ctx, nir); break; } default: -- 2.30.2