zink: unify zink_resource_object_init_mutable() calling
this all goes through surface creation the same way Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35722>
This commit is contained in:
@@ -1963,9 +1963,6 @@ create_image_surface(struct zink_context *ctx, const struct pipe_image_view *vie
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
if (zink_format_needs_mutable(pres->format, view->format))
|
||||
/* mutable not set by default */
|
||||
zink_resource_object_init_mutable(ctx, res);
|
||||
VkImageViewCreateInfo ivci = create_ivci(screen, res, &tmpl, target);
|
||||
struct zink_surface *surface = zink_get_surface(ctx, pres, &tmpl, &ivci);
|
||||
if (!surface)
|
||||
@@ -2286,9 +2283,6 @@ zink_set_sampler_views(struct pipe_context *pctx,
|
||||
if (!ctx->unordered_blitting)
|
||||
res->obj->unordered_read = false;
|
||||
} else {
|
||||
if (zink_format_needs_mutable(res->base.b.format, b->image_view->base.format))
|
||||
/* mutable not set by default */
|
||||
zink_resource_object_init_mutable(ctx, res);
|
||||
if (res->obj != b->image_view->obj) {
|
||||
struct pipe_surface *psurf = &b->image_view->base;
|
||||
VkImageView iv = b->image_view->image_view;
|
||||
|
||||
@@ -205,6 +205,12 @@ zink_get_surface(struct zink_context *ctx,
|
||||
{
|
||||
struct zink_surface *surface = NULL;
|
||||
struct zink_resource *res = zink_resource(pres);
|
||||
|
||||
if (!res->obj->dt && zink_format_needs_mutable(pres->format, templ->format))
|
||||
/* mutable not set by default */
|
||||
zink_resource_object_init_mutable(ctx, res);
|
||||
/* reset for mutable obj switch */
|
||||
ivci->image = res->obj->image;
|
||||
uint32_t hash = hash_ivci(ivci);
|
||||
|
||||
simple_mtx_lock(&res->surface_mtx);
|
||||
@@ -250,16 +256,10 @@ zink_create_surface(struct pipe_context *pctx,
|
||||
struct pipe_resource *pres,
|
||||
const struct pipe_surface *templ)
|
||||
{
|
||||
struct zink_context *ctx = zink_context(pctx);
|
||||
struct zink_resource *res = zink_resource(pres);
|
||||
struct zink_screen *screen = zink_screen(pctx->screen);
|
||||
bool is_array = templ->last_layer != templ->first_layer;
|
||||
enum pipe_texture_target target_2d[] = {PIPE_TEXTURE_2D, PIPE_TEXTURE_2D_ARRAY};
|
||||
if (!res->obj->dt && zink_format_needs_mutable(pres->format, templ->format)) {
|
||||
/* mutable not set by default */
|
||||
if (!(res->base.b.bind & ZINK_BIND_MUTABLE))
|
||||
zink_resource_object_init_mutable(ctx, res);
|
||||
}
|
||||
|
||||
if (!zink_get_format(screen, templ->format))
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user