Only emit partial flushes when the underlying shader stages are using bindless samplers or images.
This gets rid of 4% of partial flushes in the DOW3 benchmark. Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com> --- src/gallium/drivers/radeonsi/si_descriptors.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index 88f7dcee959..7d8b3670887 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -1934,14 +1934,28 @@ static void si_upload_bindless_descriptor(struct si_context *sctx, static void si_upload_bindless_descriptors(struct si_context *sctx) { + unsigned shader_uses_bindless_mask; + if (!sctx->bindless_descriptors_dirty) return; /* Wait for graphics/compute to be idle before updating the resident * descriptors directly in memory, in case the GPU is using them. */ - sctx->b.flags |= SI_CONTEXT_PS_PARTIAL_FLUSH | - SI_CONTEXT_CS_PARTIAL_FLUSH; + sctx->b.flags |= SI_CONTEXT_CS_PARTIAL_FLUSH; + + /* To avoid unnecessary partial flushes, check which shader stages are + * using bindless samplers or images. + */ + shader_uses_bindless_mask = sctx->shader_uses_bindless_samplers_mask | + sctx->shader_uses_bindless_images_mask; + + if (shader_uses_bindless_mask & (1 << PIPE_SHADER_FRAGMENT)) { + sctx->b.flags |= SI_CONTEXT_PS_PARTIAL_FLUSH; + } else if (shader_uses_bindless_mask) { + sctx->b.flags |= SI_CONTEXT_VS_PARTIAL_FLUSH; + } + si_emit_cache_flush(sctx); util_dynarray_foreach(&sctx->resident_tex_handles, -- 2.13.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev