diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 27db703ee86..a5932cf3b30 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -147,8 +147,12 @@ set_io_mask(nir_shader *shader, nir_variable *var, int offset, int len, shader->info.inputs_read_indirectly |= bitfield; } - if (cross_invocation && shader->info.stage == MESA_SHADER_TESS_CTRL) - shader->info.tess.tcs_cross_invocation_inputs_read |= bitfield; + if (shader->info.stage == MESA_SHADER_TESS_CTRL) { + if (cross_invocation) + shader->info.tess.tcs_cross_invocation_inputs_read |= bitfield; + else + shader->info.tess.tcs_same_invocation_inputs_read |= bitfield; + } if (shader->info.stage == MESA_SHADER_FRAGMENT) { shader->info.fs.uses_sample_qualifier |= var->data.sample; @@ -564,9 +568,12 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader, } if (shader->info.stage == MESA_SHADER_TESS_CTRL && - instr->intrinsic == nir_intrinsic_load_per_vertex_input && - !src_is_invocation_id(nir_get_io_arrayed_index_src(instr))) - shader->info.tess.tcs_cross_invocation_inputs_read |= slot_mask; + instr->intrinsic == nir_intrinsic_load_per_vertex_input) { + if (src_is_invocation_id(nir_get_io_arrayed_index_src(instr))) + shader->info.tess.tcs_same_invocation_inputs_read |= slot_mask; + else + shader->info.tess.tcs_cross_invocation_inputs_read |= slot_mask; + } break; case nir_intrinsic_load_output: @@ -1022,6 +1029,7 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint) shader->info.fs.needs_quad_helper_invocations = false; } if (shader->info.stage == MESA_SHADER_TESS_CTRL) { + shader->info.tess.tcs_same_invocation_inputs_read = 0; shader->info.tess.tcs_cross_invocation_inputs_read = 0; shader->info.tess.tcs_cross_invocation_outputs_read = 0; } diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 45f9347823f..41e02e5fa03 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -2587,6 +2587,8 @@ print_shader_info(const struct shader_info *info, FILE *fp) print_nz_bool(fp, "ccw", info->tess.ccw); print_nz_bool(fp, "point_mode", info->tess.point_mode); + print_nz_x64(fp, "tcs_same_invocation_inputs_read", + info->tess.tcs_same_invocation_inputs_read); print_nz_x64(fp, "tcs_cross_invocation_inputs_read", info->tess.tcs_cross_invocation_inputs_read); print_nz_x64(fp, "tcs_cross_invocation_outputs_read", info->tess.tcs_cross_invocation_outputs_read); break; diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index 2289bb23654..b1ddcce99bd 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -490,6 +490,14 @@ typedef struct shader_info { bool ccw:1; bool point_mode:1; + /* Bit mask of TCS per-vertex inputs (VS outputs) that are used + * with a vertex index that is equal to the invocation id. + * + * Not mutually exclusive with tcs_cross_invocation_inputs_read, i.e. + * both input[0] and input[invocation_id] can be present. + */ + uint64_t tcs_same_invocation_inputs_read; + /* Bit mask of TCS per-vertex inputs (VS outputs) that are used * with a vertex index that is NOT the invocation id */