Mesa (main): zink: add a pipe_context::set_sample_locations hook

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


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

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

zink: add a pipe_context::set_sample_locations hook

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  |  3 +++
 src/gallium/drivers/zink/zink_pipeline.h |  1 +
 3 files changed, 17 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 96b34e8f45b..5cd34ace8a1 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1922,6 +1922,18 @@ zink_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask)
    ctx->gfx_pipeline_state.dirty = true;
 }
 
+static void
+zink_set_sample_locations(struct pipe_context *pctx, size_t size, const uint8_t *locations)
+{
+   struct zink_context *ctx = zink_context(pctx);
+
+   ctx->gfx_pipeline_state.sample_locations_enabled = size && locations;
+   ctx->sample_locations_changed = ctx->gfx_pipeline_state.sample_locations_enabled;
+   if (size > sizeof(ctx->sample_locations))
+      size = sizeof(ctx->sample_locations);
+   memcpy(ctx->sample_locations, locations, size);
+}
+
 static VkAccessFlags
 access_src_flags(VkImageLayout layout)
 {
@@ -3296,6 +3308,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
    ctx->base.set_sampler_views = zink_set_sampler_views;
    ctx->base.sampler_view_destroy = zink_sampler_view_destroy;
    ctx->base.get_sample_position = zink_get_sample_position;
+   ctx->base.set_sample_locations = zink_set_sample_locations;
 
    zink_program_init(ctx);
 
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 864cd3b29c5..4c468e92d81 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -209,6 +209,9 @@ struct zink_context {
    float line_width;
    float blend_constants[4];
 
+   bool sample_locations_changed;
+   uint8_t sample_locations[2 * 4 * 8 * 16];
+
    bool drawid_broken;
 
    struct pipe_stencil_ref stencil_ref;
diff --git a/src/gallium/drivers/zink/zink_pipeline.h b/src/gallium/drivers/zink/zink_pipeline.h
index 0c39acc30e3..fec7af77276 100644
--- a/src/gallium/drivers/zink/zink_pipeline.h
+++ b/src/gallium/drivers/zink/zink_pipeline.h
@@ -74,6 +74,7 @@ struct zink_gfx_pipeline_state {
 
    uint32_t vertex_buffers_enabled_mask;
    uint32_t vertex_strides[PIPE_MAX_ATTRIBS];
+   bool sample_locations_enabled;
    bool have_EXT_extended_dynamic_state;
 
    VkPipeline pipeline;



More information about the mesa-commit mailing list