zink: create a surface for resolve resources

this can be reused since the state tracker doesn't give a surface

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30772>
This commit is contained in:
Mike Blumenkrantz
2023-02-14 13:09:48 -05:00
committed by Marge Bot
parent cd7ad7bd7e
commit 2c700bb842
3 changed files with 13 additions and 0 deletions

View File

@@ -3850,6 +3850,17 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
} else { } else {
ctx->depth_bias_scale_factor = 0; ctx->depth_bias_scale_factor = 0;
} }
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);
}
}
if (depth_bias_scale_factor != ctx->depth_bias_scale_factor && if (depth_bias_scale_factor != ctx->depth_bias_scale_factor &&
ctx->rast_state && ctx->rast_state->base.offset_units_unscaled) ctx->rast_state && ctx->rast_state->base.offset_units_unscaled)
ctx->rast_state_changed = true; ctx->rast_state_changed = true;

View File

@@ -244,6 +244,7 @@ zink_resource_destroy(struct pipe_screen *pscreen,
assert(!_mesa_hash_table_num_entries(&res->surface_cache)); assert(!_mesa_hash_table_num_entries(&res->surface_cache));
simple_mtx_destroy(&res->surface_mtx); simple_mtx_destroy(&res->surface_mtx);
ralloc_free(res->surface_cache.table); ralloc_free(res->surface_cache.table);
pipe_surface_reference(&res->surface, NULL);
} }
/* no need to do anything for the caches, these objects own the resource lifetimes */ /* no need to do anything for the caches, these objects own the resource lifetimes */

View File

@@ -1288,6 +1288,7 @@ struct zink_resource {
enum pipe_format internal_format:16; enum pipe_format internal_format:16;
struct zink_resource_object *obj; struct zink_resource_object *obj;
struct pipe_surface *surface; //for swapchain images
uint32_t queue; uint32_t queue;
union { union {
struct { struct {