From 0c5f3e50aea46b1aa9456c40ac0607253fcd06cd Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 23 Oct 2018 09:22:34 +1000 Subject: [PATCH] zink: add sample mask support This isn't really used yet, but may as well just fill it in. Acked-by: Jordan Justen --- src/gallium/drivers/zink/zink_context.c | 9 +++++++++ src/gallium/drivers/zink/zink_pipeline.c | 1 + src/gallium/drivers/zink/zink_pipeline.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index ca111b70659..fb3ee0f6b6f 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -642,6 +642,13 @@ zink_set_blend_color(struct pipe_context *pctx, memcpy(ctx->blend_constants, color->color, sizeof(float) * 4); } +static void +zink_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask) +{ + struct zink_context *ctx = zink_context(pctx); + ctx->gfx_pipeline_state.sample_mask = sample_mask; +} + static VkAccessFlags access_flags(VkImageLayout layout) { @@ -1344,6 +1351,8 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) ctx->base.set_active_query_state = zink_set_active_query_state; ctx->base.set_blend_color = zink_set_blend_color; + ctx->base.set_sample_mask = zink_set_sample_mask; + ctx->base.clear = zink_clear; ctx->base.draw_vbo = zink_draw_vbo; ctx->base.flush = zink_flush; diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c index 0dd89187ba4..3850395b660 100644 --- a/src/gallium/drivers/zink/zink_pipeline.c +++ b/src/gallium/drivers/zink/zink_pipeline.c @@ -62,6 +62,7 @@ zink_create_gfx_pipeline(VkDevice dev, struct zink_gfx_program *prog, ms_state.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; ms_state.alphaToCoverageEnable = state->blend_state->alpha_to_coverage; ms_state.alphaToOneEnable = state->blend_state->alpha_to_one; + ms_state.pSampleMask = state->sample_mask ? &state->sample_mask : NULL; VkPipelineViewportStateCreateInfo viewport_state = {}; viewport_state.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; diff --git a/src/gallium/drivers/zink/zink_pipeline.h b/src/gallium/drivers/zink/zink_pipeline.h index 87747fce740..ec896d0d583 100644 --- a/src/gallium/drivers/zink/zink_pipeline.h +++ b/src/gallium/drivers/zink/zink_pipeline.h @@ -49,6 +49,8 @@ struct zink_gfx_pipeline_state { struct zink_depth_stencil_alpha_state *depth_stencil_alpha_state; float line_width; + + VkSampleMask sample_mask; }; VkPipeline -- 2.30.2