mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 13:00:09 +01:00
zink: be smarter about fb surface rebinds
the aspect info lets us avoid unnecessary comparisons Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12843>
This commit is contained in:
parent
46a262dc1e
commit
372f7d4726
1 changed files with 13 additions and 10 deletions
|
|
@ -3161,16 +3161,19 @@ zink_rebind_framebuffer(struct zink_context *ctx, struct zink_resource *res)
|
|||
{
|
||||
if (!ctx->framebuffer)
|
||||
return;
|
||||
for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) {
|
||||
if (!ctx->fb_state.cbufs[i] ||
|
||||
zink_resource(ctx->fb_state.cbufs[i]->texture) != res)
|
||||
continue;
|
||||
zink_rebind_ctx_surface(ctx, &ctx->fb_state.cbufs[i]);
|
||||
zink_batch_no_rp(ctx);
|
||||
}
|
||||
if (ctx->fb_state.zsbuf && zink_resource(ctx->fb_state.zsbuf->texture) != res) {
|
||||
zink_rebind_ctx_surface(ctx, &ctx->fb_state.zsbuf);
|
||||
zink_batch_no_rp(ctx);
|
||||
if (res->aspect & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) {
|
||||
if (!ctx->fb_state.cbufs[i] ||
|
||||
zink_resource(ctx->fb_state.cbufs[i]->texture) != res)
|
||||
continue;
|
||||
zink_rebind_ctx_surface(ctx, &ctx->fb_state.cbufs[i]);
|
||||
zink_batch_no_rp(ctx);
|
||||
}
|
||||
} else {
|
||||
if (ctx->fb_state.zsbuf && zink_resource(ctx->fb_state.zsbuf->texture) != res) {
|
||||
zink_rebind_ctx_surface(ctx, &ctx->fb_state.zsbuf);
|
||||
zink_batch_no_rp(ctx);
|
||||
}
|
||||
}
|
||||
if (rebind_fb_state(ctx, res, false))
|
||||
zink_batch_no_rp(ctx);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue