zink: extract resolve surface init to separate function
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35477>
This commit is contained in:
@@ -4010,19 +4010,8 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
|
||||
zink_resource(psurf->texture)->fb_binds |= BITFIELD_BIT(PIPE_MAX_COLOR_BUFS);
|
||||
}
|
||||
|
||||
if (ctx->fb_state.resolve) {
|
||||
struct zink_resource *res = zink_resource(ctx->fb_state.resolve);
|
||||
if (!res->surface) {
|
||||
struct pipe_surface tmpl = {0};
|
||||
tmpl.format = res->base.b.format;
|
||||
zink_screen_lock_context(screen);
|
||||
res->surface = screen->copy_context->base.create_surface(&screen->copy_context->base, &res->base.b, &tmpl);
|
||||
zink_screen_unlock_context(screen);
|
||||
/* delete extra ref: the resource controls the surface lifetime, not the other way around */
|
||||
struct pipe_resource *pres = ctx->fb_state.resolve;
|
||||
pipe_resource_reference(&pres, NULL);
|
||||
}
|
||||
}
|
||||
if (ctx->fb_state.resolve)
|
||||
zink_surface_resolve_init(screen, zink_resource(ctx->fb_state.resolve));
|
||||
rebind_fb_state(ctx, NULL, true);
|
||||
ctx->fb_state.samples = MAX2(samples, 1);
|
||||
if (ctx->fb_state.width != w || ctx->fb_state.height != h)
|
||||
|
||||
@@ -477,3 +477,18 @@ zink_surface_swapchain_update(struct zink_context *ctx, struct zink_surface *sur
|
||||
/* the current swapchain imageview is now the view for the current swapchain image */
|
||||
surface->image_view = surface->swapchain[res->obj->dt_idx];
|
||||
}
|
||||
|
||||
void
|
||||
zink_surface_resolve_init(struct zink_screen *screen, struct zink_resource *res)
|
||||
{
|
||||
if (res->surface)
|
||||
return;
|
||||
struct pipe_surface tmpl = {0};
|
||||
tmpl.format = res->base.b.format;
|
||||
zink_screen_lock_context(screen);
|
||||
res->surface = screen->copy_context->base.create_surface(&screen->copy_context->base, &res->base.b, &tmpl);
|
||||
zink_screen_unlock_context(screen);
|
||||
/* delete extra ref: the resource controls the surface lifetime, not the other way around */
|
||||
struct pipe_resource *pres = &res->base.b;
|
||||
pipe_resource_reference(&pres, NULL);
|
||||
}
|
||||
|
||||
@@ -82,4 +82,7 @@ zink_surface_create_null(struct zink_context *ctx, enum pipe_texture_target targ
|
||||
|
||||
void
|
||||
zink_surface_swapchain_update(struct zink_context *ctx, struct zink_surface *surface);
|
||||
void
|
||||
zink_surface_resolve_init(struct zink_screen *screen, struct zink_resource *res);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user