Mesa (master): lavapipe: refactor image surface creation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jan 27 01:28:57 UTC 2021
Module: Mesa
Branch: master
Commit: 4be0e92db10584bc3526884b92aa483458aa93af
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4be0e92db10584bc3526884b92aa483458aa93af
Author: Dave Airlie <airlied at redhat.com>
Date: Mon Dec 21 14:49:50 2020 +1000
lavapipe: refactor image surface creation
There is a need to create arbitrary surfaces for clearing,
so split out the templating from the storing to img->vk_surface
so temporary surfaces can be created for clearing.
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8182>
---
src/gallium/frontends/lavapipe/lvp_execute.c | 41 ++++++++++++++++++----------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c
index cfc77ae38a9..3c85dcd86d0 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -1096,25 +1096,36 @@ static void handle_descriptor_sets(struct lvp_cmd_buffer_entry *cmd,
}
}
-static void add_img_view_surface(struct rendering_state *state,
- struct lvp_image_view *imgv, VkFormat format, int width, int height)
+static struct pipe_surface *create_img_surface(struct rendering_state *state,
+ struct lvp_image_view *imgv,
+ VkFormat format, int width,
+ int height,
+ int base_layer, int layer_count)
{
- if (!imgv->surface) {
- struct pipe_surface template;
+ struct pipe_surface template;
- memset(&template, 0, sizeof(struct pipe_surface));
+ memset(&template, 0, sizeof(struct pipe_surface));
- template.format = vk_format_to_pipe(format);
- template.width = width;
- template.height = height;
- template.u.tex.first_layer = imgv->subresourceRange.baseArrayLayer;
- template.u.tex.last_layer = imgv->subresourceRange.baseArrayLayer + lvp_get_layerCount(imgv->image, &imgv->subresourceRange) - 1;
- template.u.tex.level = imgv->subresourceRange.baseMipLevel;
+ template.format = vk_format_to_pipe(format);
+ template.width = width;
+ template.height = height;
+ template.u.tex.first_layer = imgv->subresourceRange.baseArrayLayer + base_layer;
+ template.u.tex.last_layer = imgv->subresourceRange.baseArrayLayer + layer_count;
+ template.u.tex.level = imgv->subresourceRange.baseMipLevel;
- if (template.format == PIPE_FORMAT_NONE)
- return;
- imgv->surface = state->pctx->create_surface(state->pctx,
- imgv->image->bo, &template);
+ if (template.format == PIPE_FORMAT_NONE)
+ return NULL;
+ return state->pctx->create_surface(state->pctx,
+ imgv->image->bo, &template);
+
+}
+static void add_img_view_surface(struct rendering_state *state,
+ struct lvp_image_view *imgv, VkFormat format, int width, int height)
+{
+ if (!imgv->surface) {
+ imgv->surface = create_img_surface(state, imgv, format,
+ width, height,
+ 0, lvp_get_layerCount(imgv->image, &imgv->subresourceRange) - 1);
}
}
More information about the mesa-commit
mailing list