diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2021-04-02 17:35:36 -0400 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-06-09 17:26:52 +0000 |
commit | 0901d362c7f1af9bc7e75814bcd49b1b6f7b0d9f (patch) | |
tree | 7a3af332cfbc7d02bb3e590e65f47937e8172585 | |
parent | dcbb77566e16c7b44ed7a6ad93049bb5e71313c7 (diff) |
zink: add a util function for populating VkSampleLocationsInfoEXT
this will be reused
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11189>
-rw-r--r-- | src/gallium/drivers/zink/zink_context.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/zink/zink_context.h | 4 |
2 files changed, 17 insertions, 0 deletions
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 @@ -1617,6 +1617,19 @@ begin_render_pass(struct zink_context *ctx) } 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) { setup_framebuffer(ctx); 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 |