radeonsi: use mask for uses_bindless_samplers/images

For simpler code and mesh shader support which need to
distinguish vertex and mesh pipeline.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35931>
This commit is contained in:
Qiang Yu
2025-04-18 17:33:00 +08:00
committed by Marge Bot
parent b337e60a6f
commit d0f76c4cd4
5 changed files with 27 additions and 40 deletions
+11 -21
View File
@@ -855,14 +855,15 @@ void gfx6_decompress_textures(struct si_context *sctx, unsigned shader_mask)
sctx->b.flush(&sctx->b, NULL, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW);
}
if (shader_mask & BITFIELD_MASK(SI_NUM_GRAPHICS_SHADERS)) {
if (sctx->uses_bindless_samplers) {
si_decompress_resident_color_textures(sctx);
si_decompress_resident_depth_textures(sctx);
}
if (sctx->uses_bindless_images)
si_decompress_resident_images(sctx);
if (sctx->uses_bindless_samplers & shader_mask) {
si_decompress_resident_color_textures(sctx);
si_decompress_resident_depth_textures(sctx);
}
if (sctx->uses_bindless_images & shader_mask)
si_decompress_resident_images(sctx);
if (shader_mask & BITFIELD_BIT(PIPE_SHADER_FRAGMENT)) {
if (sctx->ps_uses_fbfetch) {
struct pipe_surface *cb0 = &sctx->framebuffer.state.cbufs[0];
si_decompress_color_texture(sctx, (struct si_texture *)cb0->texture,
@@ -870,13 +871,6 @@ void gfx6_decompress_textures(struct si_context *sctx, unsigned shader_mask)
}
si_check_render_feedback(sctx);
} else if (shader_mask & (1 << PIPE_SHADER_COMPUTE)) {
if (sctx->cs_shader_state.program->sel.info.uses_bindless_samplers) {
si_decompress_resident_color_textures(sctx);
si_decompress_resident_depth_textures(sctx);
}
if (sctx->cs_shader_state.program->sel.info.uses_bindless_images)
si_decompress_resident_images(sctx);
}
}
@@ -893,15 +887,11 @@ void gfx11_decompress_textures(struct si_context *sctx, unsigned shader_mask)
}
/* Decompress bindless depth textures and disable DCC for render feedback. */
if (shader_mask & BITFIELD_MASK(SI_NUM_GRAPHICS_SHADERS)) {
if (sctx->uses_bindless_samplers)
si_decompress_resident_depth_textures(sctx);
if (sctx->uses_bindless_samplers & shader_mask)
si_decompress_resident_depth_textures(sctx);
if (shader_mask & BITFIELD_BIT(PIPE_SHADER_FRAGMENT))
si_check_render_feedback(sctx);
} else if (shader_mask & (1 << PIPE_SHADER_COMPUTE)) {
if (sctx->cs_shader_state.program->sel.info.uses_bindless_samplers)
si_decompress_resident_depth_textures(sctx);
}
}
/* Helper for decompressing a portion of a color or depth resource before
+1 -5
View File
@@ -220,11 +220,7 @@ static void si_bind_compute_state(struct pipe_context *ctx, void *state)
/* Wait because we need active slot usage masks. */
util_queue_fence_wait(&sel->ready);
si_set_active_descriptors(sctx,
SI_DESCS_FIRST_COMPUTE + SI_SHADER_DESCS_CONST_AND_SHADER_BUFFERS,
sel->active_const_and_shader_buffers);
si_set_active_descriptors(sctx, SI_DESCS_FIRST_COMPUTE + SI_SHADER_DESCS_SAMPLERS_AND_IMAGES,
sel->active_samplers_and_images);
si_update_common_shader_state(sctx, sel, PIPE_SHADER_COMPUTE);
sctx->compute_shaderbuf_sgprs_dirty = true;
sctx->compute_image_sgprs_dirty = true;
+2 -2
View File
@@ -1272,8 +1272,8 @@ struct si_context {
struct util_dynarray resident_tex_needs_depth_decompress;
/* Bindless state */
bool uses_bindless_samplers;
bool uses_bindless_images;
uint8_t uses_bindless_samplers;
uint8_t uses_bindless_images;
/* Misc stats. */
unsigned num_draw_calls;
+2
View File
@@ -678,6 +678,8 @@ bool si_update_gs_ring_buffers(struct si_context *sctx);
bool si_update_spi_tmpring_size(struct si_context *sctx, unsigned bytes);
bool si_set_tcs_to_fixed_func_shader(struct si_context *sctx);
void si_update_tess_io_layout_state(struct si_context *sctx);
void si_update_common_shader_state(struct si_context *sctx, struct si_shader_selector *sel,
enum pipe_shader_type type);
/* si_state_draw.cpp */
void si_cp_dma_prefetch(struct si_context *sctx, struct pipe_resource *buf,
@@ -3647,21 +3647,20 @@ static void si_update_rasterized_prim(struct si_context *sctx)
si_update_ngg_sgpr_state_out_prim(sctx, hw_vs, sctx->ngg);
}
static void si_update_common_shader_state(struct si_context *sctx, struct si_shader_selector *sel,
enum pipe_shader_type type)
void si_update_common_shader_state(struct si_context *sctx, struct si_shader_selector *sel,
enum pipe_shader_type type)
{
si_set_active_descriptors_for_shader(sctx, sel);
sctx->uses_bindless_samplers = si_shader_uses_bindless_samplers(sctx->shader.vs.cso) ||
si_shader_uses_bindless_samplers(sctx->shader.gs.cso) ||
si_shader_uses_bindless_samplers(sctx->shader.ps.cso) ||
si_shader_uses_bindless_samplers(sctx->shader.tcs.cso) ||
si_shader_uses_bindless_samplers(sctx->shader.tes.cso);
sctx->uses_bindless_images = si_shader_uses_bindless_images(sctx->shader.vs.cso) ||
si_shader_uses_bindless_images(sctx->shader.gs.cso) ||
si_shader_uses_bindless_images(sctx->shader.ps.cso) ||
si_shader_uses_bindless_images(sctx->shader.tcs.cso) ||
si_shader_uses_bindless_images(sctx->shader.tes.cso);
if (si_shader_uses_bindless_samplers(sel))
sctx->uses_bindless_samplers |= BITFIELD_BIT(type);
else
sctx->uses_bindless_samplers &= ~BITFIELD_BIT(type);
if (si_shader_uses_bindless_images(sel))
sctx->uses_bindless_images |= BITFIELD_BIT(type);
else
sctx->uses_bindless_images &= ~BITFIELD_BIT(type);
if (type == PIPE_SHADER_VERTEX || type == PIPE_SHADER_TESS_EVAL || type == PIPE_SHADER_GEOMETRY)
sctx->ngg_culling = 0; /* this will be enabled on the first draw if needed */