diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 5dfa9484e82..60bd2324121 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -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; diff --git a/src/gallium/drivers/zink/zink_surface.c b/src/gallium/drivers/zink/zink_surface.c index b27c61d1b2d..03d4b562b7c 100644 --- a/src/gallium/drivers/zink/zink_surface.c +++ b/src/gallium/drivers/zink/zink_surface.c @@ -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; } diff --git a/src/gallium/drivers/zink/zink_surface.h b/src/gallium/drivers/zink/zink_surface.h index badd08d77f4..9207b2e8b89 100644 --- a/src/gallium/drivers/zink/zink_surface.h +++ b/src/gallium/drivers/zink/zink_surface.h @@ -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,