zink: add a pipe_context::set_sample_locations hook

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11189>
This commit is contained in:
Mike Blumenkrantz 2021-04-02 17:32:34 -04:00 committed by Marge Bot
parent 9075f623a4
commit 60e98d0f47
3 changed files with 17 additions and 0 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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;