mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 02:58:05 +02:00
zink: Change zink_get_surface to return a zink_surface
Allows to avoid systematic casting of its return value. Signed-off-by: Corentin Noël <corentin.noel@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28025>
This commit is contained in:
parent
207db01829
commit
28854743dc
3 changed files with 9 additions and 10 deletions
|
|
@ -1232,10 +1232,10 @@ zink_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *pres,
|
|||
}
|
||||
assert(ivci.format);
|
||||
|
||||
sampler_view->image_view = (struct zink_surface*)zink_get_surface(ctx, pres, &templ, &ivci);
|
||||
sampler_view->image_view = zink_get_surface(ctx, pres, &templ, &ivci);
|
||||
if (!screen->info.have_EXT_non_seamless_cube_map && viewtype_is_cube(&sampler_view->image_view->ivci)) {
|
||||
ivci.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
sampler_view->cube_array = (struct zink_surface*)zink_get_surface(ctx, pres, &templ, &ivci);
|
||||
sampler_view->cube_array = zink_get_surface(ctx, pres, &templ, &ivci);
|
||||
} else if (red_depth_sampler_view) {
|
||||
/* there is only one component, and real swizzling can't be done here,
|
||||
* so ensure the shader gets the sampled data
|
||||
|
|
@ -1244,7 +1244,7 @@ zink_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *pres,
|
|||
ivci.components.g = VK_COMPONENT_SWIZZLE_R;
|
||||
ivci.components.b = VK_COMPONENT_SWIZZLE_R;
|
||||
ivci.components.a = VK_COMPONENT_SWIZZLE_R;
|
||||
sampler_view->zs_view = (struct zink_surface*)zink_get_surface(ctx, pres, &templ, &ivci);
|
||||
sampler_view->zs_view = zink_get_surface(ctx, pres, &templ, &ivci);
|
||||
}
|
||||
err = !sampler_view->image_view;
|
||||
} else {
|
||||
|
|
@ -1842,10 +1842,9 @@ create_image_surface(struct zink_context *ctx, const struct pipe_image_view *vie
|
|||
/* mutable not set by default */
|
||||
zink_resource_object_init_mutable(ctx, res);
|
||||
VkImageViewCreateInfo ivci = create_ivci(screen, res, &tmpl, target);
|
||||
struct pipe_surface *psurf = zink_get_surface(ctx, view->resource, &tmpl, &ivci);
|
||||
if (!psurf)
|
||||
struct zink_surface *surface = zink_get_surface(ctx, view->resource, &tmpl, &ivci);
|
||||
if (!surface)
|
||||
return NULL;
|
||||
struct zink_surface *surface = zink_surface(psurf);
|
||||
if (is_compute)
|
||||
flush_pending_clears(ctx, res);
|
||||
return surface;
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ do_create_surface(struct pipe_context *pctx, struct pipe_resource *pres, const s
|
|||
}
|
||||
|
||||
/* get a cached surface for a shader descriptor */
|
||||
struct pipe_surface *
|
||||
struct zink_surface *
|
||||
zink_get_surface(struct zink_context *ctx,
|
||||
struct pipe_resource *pres,
|
||||
const struct pipe_surface *templ,
|
||||
|
|
@ -264,7 +264,7 @@ zink_get_surface(struct zink_context *ctx,
|
|||
}
|
||||
simple_mtx_unlock(&res->surface_mtx);
|
||||
|
||||
return &surface->base;
|
||||
return surface;
|
||||
}
|
||||
|
||||
/* wrap a surface for use as a framebuffer attachment
|
||||
|
|
@ -351,7 +351,7 @@ zink_create_surface(struct pipe_context *pctx,
|
|||
|
||||
surface->is_swapchain = true;
|
||||
} else if (!needs_mutable) {
|
||||
surface = (struct zink_surface*)zink_get_surface(zink_context(pctx), pres, templ, &ivci);
|
||||
surface = zink_get_surface(zink_context(pctx), pres, templ, &ivci);
|
||||
if (unlikely(!surface))
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ create_ivci(struct zink_screen *screen,
|
|||
const struct pipe_surface *templ,
|
||||
enum pipe_texture_target target);
|
||||
|
||||
struct pipe_surface *
|
||||
struct zink_surface *
|
||||
zink_get_surface(struct zink_context *ctx,
|
||||
struct pipe_resource *pres,
|
||||
const struct pipe_surface *templ,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue