diff --git a/src/gallium/drivers/radeonsi/si_shader_info.c b/src/gallium/drivers/radeonsi/si_shader_info.c index 9d5875c9d7e..f222e3f0ed0 100644 --- a/src/gallium/drivers/radeonsi/si_shader_info.c +++ b/src/gallium/drivers/radeonsi/si_shader_info.c @@ -194,8 +194,9 @@ static void scan_io_usage(const nir_shader *nir, struct si_shader_info *info, if (slot_semantic == VARYING_SLOT_TESS_LEVEL_INNER || slot_semantic == VARYING_SLOT_TESS_LEVEL_OUTER) { if (!nir_intrinsic_io_semantics(intr).no_varying) { - info->tess_levels_written_for_tes |= - BITFIELD_BIT(ac_shader_io_get_unique_index_patch(slot_semantic)); + unsigned index = ac_shader_io_get_unique_index_patch(slot_semantic); + info->num_tess_level_vram_outputs = + MAX2(info->num_tess_level_vram_outputs, index + 1); } } else if ((slot_semantic <= VARYING_SLOT_VAR31 || slot_semantic >= VARYING_SLOT_VAR0_16BIT) && diff --git a/src/gallium/drivers/radeonsi/si_shader_info.h b/src/gallium/drivers/radeonsi/si_shader_info.h index eb831bda96d..5136c4104a8 100644 --- a/src/gallium/drivers/radeonsi/si_shader_info.h +++ b/src/gallium/drivers/radeonsi/si_shader_info.h @@ -108,7 +108,7 @@ struct si_shader_info { /* For VS before {TCS, TES, GS} and TES before GS. */ uint64_t ls_es_outputs_written; /* "get_unique_index" bits */ uint64_t outputs_written_before_ps; /* "get_unique_index" bits */ - uint32_t tess_levels_written_for_tes; /* "get_unique_index_patch" bits */ + uint8_t num_tess_level_vram_outputs; /* max "get_unique_index_patch" + 1*/ uint8_t clipdist_mask; uint8_t culldist_mask; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp b/src/gallium/drivers/radeonsi/si_state_shaders.cpp index 51c6b3bd58f..5b34eb2c016 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp +++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp @@ -4810,8 +4810,8 @@ void si_update_tess_io_layout_state(struct si_context *sctx) unsigned num_tcs_output_cp = tcs->info.base.tess.tcs_vertices_out; unsigned lds_input_vertex_size = si_shader_lshs_vertex_stride(ls_current); unsigned num_remapped_tess_level_outputs = - util_last_bit(!ls_current->is_monolithic || ls_current->key.ge.opt.tes_reads_tess_factors ? - tcs->info.tess_levels_written_for_tes : 0); + !ls_current->is_monolithic || ls_current->key.ge.opt.tes_reads_tess_factors ? + tcs->info.num_tess_level_vram_outputs : 0; unsigned num_patches, lds_size; /* Compute NUM_PATCHES and LDS_SIZE. */