Mesa (main): zink: clear out all ubo rebinds first if they exist
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 24 14:36:55 UTC 2021
Module: Mesa
Branch: main
Commit: a9ccef9bc773af72582271537876577166a3c642
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9ccef9bc773af72582271537876577166a3c642
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri May 14 19:07:27 2021 -0400
zink: clear out all ubo rebinds first if they exist
these are the second most common rebind, so iterate them all first
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12425>
---
src/gallium/drivers/zink/zink_context.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index ad9f4da64aa..f674ec7bfdb 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -3148,15 +3148,20 @@ rebind_buffer(struct zink_context *ctx, struct zink_resource *res)
}
ctx->vertex_buffers_dirty = true;
}
- for (unsigned shader = 0; num_rebinds < total_rebinds && shader < PIPE_SHADER_TYPES; shader++) {
- u_foreach_bit(slot, res->ubo_bind_mask[shader]) {
- if (&res->base.b != ctx->ubos[shader][slot].buffer) //wrong context
- return;
-
- update_descriptor_state_ubo(ctx, shader, slot);
- zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, shader, ZINK_DESCRIPTOR_TYPE_UBO, slot, 1);
- num_rebinds++;
+ if (res->ubo_bind_count[0] + res->ubo_bind_count[1] > 0) {
+ for (unsigned shader = res->ubo_bind_count[0] ? 0 : PIPE_SHADER_COMPUTE;
+ num_rebinds < total_rebinds && shader < PIPE_SHADER_TYPES; shader++) {
+ u_foreach_bit(slot, res->ubo_bind_mask[shader]) {
+ if (&res->base.b != ctx->ubos[shader][slot].buffer) //wrong context
+ return;
+
+ update_descriptor_state_ubo(ctx, shader, slot);
+ zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, shader, ZINK_DESCRIPTOR_TYPE_UBO, slot, 1);
+ num_rebinds++;
+ }
}
+ }
+ for (unsigned shader = 0; num_rebinds < total_rebinds && shader < PIPE_SHADER_TYPES; shader++) {
u_foreach_bit(slot, res->ssbo_bind_mask[shader]) {
struct pipe_shader_buffer *ssbo = &ctx->ssbos[shader][slot];
if (&res->base.b != ssbo->buffer) //wrong context
More information about the mesa-commit
mailing list