diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 7ac1d2afd43..f332f119b7f 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -1056,14 +1056,19 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint) ralloc_free(dead_ctx); shader->info.per_primitive_outputs = 0; - if (shader->info.stage == MESA_SHADER_MESH) { - nir_foreach_shader_out_variable(var, shader) { - if (var->data.per_primitive) { - assert(nir_is_arrayed_io(var, shader->info.stage)); - const unsigned slots = - glsl_count_attribute_slots(glsl_get_array_element(var->type), false); - shader->info.per_primitive_outputs |= BITFIELD64_RANGE(var->data.location, slots); - } + shader->info.per_view_outputs = 0; + nir_foreach_shader_out_variable(var, shader) { + if (var->data.per_primitive) { + assert(shader->info.stage == MESA_SHADER_MESH); + assert(nir_is_arrayed_io(var, shader->info.stage)); + const unsigned slots = + glsl_count_attribute_slots(glsl_get_array_element(var->type), false); + shader->info.per_primitive_outputs |= BITFIELD64_RANGE(var->data.location, slots); + } + if (var->data.per_view) { + const unsigned slots = + glsl_count_attribute_slots(glsl_get_array_element(var->type), false); + shader->info.per_view_outputs |= BITFIELD64_RANGE(var->data.location, slots); } } diff --git a/src/compiler/nir/nir_lower_multiview.c b/src/compiler/nir/nir_lower_multiview.c index 8242b9a46c5..82fea393bb8 100644 --- a/src/compiler/nir/nir_lower_multiview.c +++ b/src/compiler/nir/nir_lower_multiview.c @@ -239,6 +239,7 @@ nir_lower_multiview(nir_shader *shader, uint32_t view_mask) assert(var->type == glsl_vec4_type()); var->type = glsl_array_type(glsl_vec4_type(), view_count, 0); var->data.per_view = true; + shader->info.per_view_outputs |= VARYING_BIT_POS; pos_var = var; break; } diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index c0396c8c2a5..d9dadac2ca3 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -172,6 +172,9 @@ typedef struct shader_info { uint64_t per_primitive_inputs; uint64_t per_primitive_outputs; + /* Which I/O is per-view */ + uint64_t per_view_outputs; + /* Which 16-bit inputs and outputs are used corresponding to * VARYING_SLOT_VARn_16BIT. */