aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Kristóf <[email protected]>2020-02-12 14:23:17 +0100
committerMarge Bot <[email protected]>2020-03-11 08:34:10 +0000
commit7b3316f3c9930c1991fbb512897d77001644bfa5 (patch)
tree9fedadf044f73a4971d1793e6b1465dbcc904c23
parent346bd0c623fdc9882e00fdb3301b73afb9fd3fe8 (diff)
aco: Extract setup_gs_variables into a separate function.
Signed-off-by: Timur Kristóf <[email protected]> Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3964>
-rw-r--r--src/amd/compiler/aco_instruction_selection_setup.cpp38
1 files 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: