Mesa (main): zink: add a util function for populating VkSampleLocationsInfoEXT

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 9 17:40:57 UTC 2021


Module: Mesa
Branch: main
Commit: 0901d362c7f1af9bc7e75814bcd49b1b6f7b0d9f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0901d362c7f1af9bc7e75814bcd49b1b6f7b0d9f

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Apr  2 17:35:36 2021 -0400

zink: add a util function for populating VkSampleLocationsInfoEXT

this will be reused

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11189>

---

 src/gallium/drivers/zink/zink_context.c | 13 +++++++++++++
 src/gallium/drivers/zink/zink_context.h |  4 ++++
 2 files changed, 17 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 274839c67fc..cb0ffb91444 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1616,6 +1616,19 @@ begin_render_pass(struct zink_context *ctx)
    return clear_buffers;
 }
 
+void
+zink_init_vk_sample_locations(struct zink_context *ctx, VkSampleLocationsInfoEXT *loc)
+{
+   struct zink_screen *screen = zink_screen(ctx->base.screen);
+   unsigned idx = util_logbase2_ceil(MAX2(ctx->gfx_pipeline_state.rast_samples, 1));
+   loc->sType = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT;
+   loc->pNext = NULL;
+   loc->sampleLocationsPerPixel = 1 << idx;
+   loc->sampleLocationsCount = ctx->gfx_pipeline_state.rast_samples;
+   loc->sampleLocationGridSize = screen->maxSampleLocationGridSize[idx];
+   loc->pSampleLocations = ctx->vk_sample_locations;
+}
+
 void
 zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch)
 {
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 4c468e92d81..77b65af5301 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -210,6 +210,7 @@ struct zink_context {
    float blend_constants[4];
 
    bool sample_locations_changed;
+   VkSampleLocationEXT vk_sample_locations[PIPE_MAX_SAMPLE_LOCATION_GRID_SIZE * PIPE_MAX_SAMPLE_LOCATION_GRID_SIZE];
    uint8_t sample_locations[2 * 4 * 8 * 16];
 
    bool drawid_broken;
@@ -408,4 +409,7 @@ zink_buffer_view_reference(struct zink_screen *screen,
 
 void
 zink_update_descriptor_refs(struct zink_context *ctx, bool compute);
+
+void
+zink_init_vk_sample_locations(struct zink_context *ctx, VkSampleLocationsInfoEXT *loc);
 #endif



More information about the mesa-commit mailing list