zink: track min_samples state for per sample shading

Vulkan pipeline state sampleShadingEnable and minSampleShading are directly related to GL_SAMPLE_SHADING_ARB.
Track min_samples provided by st and include it in pipeline state.
This was seen as failures in cts cases where per sample shading along with sample interpolation qualifiers are tested:
dEQP-GL45-ES31.functional.shaders.multisample_interpolation.sample_qualifier.*

Cc: mesa-stable
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18314>
This commit is contained in:
SoroushIMG
2022-08-27 01:08:46 +01:00
committed by Marge Bot
parent 55e99a22f3
commit 359713d174
4 changed files with 21 additions and 3 deletions

View File

@@ -394,7 +394,7 @@ zink_blit_begin(struct zink_context *ctx, enum zink_blit_flags flags)
util_blitter_save_blend(ctx->blitter, ctx->gfx_pipeline_state.blend_state);
util_blitter_save_depth_stencil_alpha(ctx->blitter, ctx->dsa_state);
util_blitter_save_stencil_ref(ctx->blitter, &ctx->stencil_ref);
util_blitter_save_sample_mask(ctx->blitter, ctx->gfx_pipeline_state.sample_mask, 0);
util_blitter_save_sample_mask(ctx->blitter, ctx->gfx_pipeline_state.sample_mask, ctx->gfx_pipeline_state.min_samples + 1);
util_blitter_save_scissor(ctx->blitter, ctx->vp_state.scissor_states);
/* also util_blitter_save_window_rectangles when we have that? */

View File

@@ -3008,6 +3008,14 @@ zink_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask)
ctx->gfx_pipeline_state.dirty = true;
}
static void
zink_set_min_samples(struct pipe_context *pctx, unsigned min_samples)
{
struct zink_context *ctx = zink_context(pctx);
ctx->gfx_pipeline_state.min_samples = min_samples - 1;
ctx->gfx_pipeline_state.dirty = true;
}
static void
zink_set_sample_locations(struct pipe_context *pctx, size_t size, const uint8_t *locations)
{
@@ -4481,6 +4489,8 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->base.set_tess_state = zink_set_tess_state;
ctx->base.set_patch_vertices = zink_set_patch_vertices;
ctx->base.set_min_samples = zink_set_min_samples;
ctx->gfx_pipeline_state.min_samples = 0;
ctx->base.set_sample_mask = zink_set_sample_mask;
ctx->gfx_pipeline_state.sample_mask = UINT32_MAX;

View File

@@ -142,6 +142,9 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
if (hw_rast_state->force_persample_interp) {
ms_state.sampleShadingEnable = VK_TRUE;
ms_state.minSampleShading = 1.0;
} else if (state->min_samples > 0) {
ms_state.sampleShadingEnable = VK_TRUE;
ms_state.minSampleShading = (float)(state->rast_samples + 1) / (state->min_samples + 1);
}
VkPipelineViewportStateCreateInfo viewport_state = {0};
@@ -457,6 +460,9 @@ zink_create_gfx_pipeline_output(struct zink_screen *screen, struct zink_gfx_pipe
if (state->force_persample_interp) {
ms_state.sampleShadingEnable = VK_TRUE;
ms_state.minSampleShading = 1.0;
} else if (state->min_samples > 0) {
ms_state.sampleShadingEnable = VK_TRUE;
ms_state.minSampleShading = (float)(state->rast_samples + 1) / (state->min_samples + 1);
}
VkDynamicState dynamicStateEnables[30] = {

View File

@@ -628,7 +628,8 @@ struct zink_gfx_pipeline_state {
uint32_t _pad1 : 6;
uint32_t force_persample_interp:1; //duplicated for gpl hashing
/* order matches zink_gfx_output_key: uint16_t offset */
uint32_t rast_samples:16; //10 extra bits
uint32_t rast_samples:8; // 2 extra bits (can be used for new members)
uint32_t min_samples:8; // 2 extra bits (can be used for new members)
VkSampleMask sample_mask;
unsigned rp_state;
uint32_t blend_id;
@@ -768,7 +769,8 @@ struct zink_gfx_input_key {
struct zink_gfx_output_key {
uint32_t _pad:15;
uint32_t force_persample_interp:1;
uint32_t rast_samples:16;
uint32_t rast_samples:8; // 2 extra bits (can be used for new members)
uint32_t min_samples:8; // 2 extra bits (can be used for new members)
VkSampleMask sample_mask;
unsigned rp_state;