From: antonino Date: Thu, 20 Apr 2023 13:18:23 +0000 (+0200) Subject: zink: add `single_sample` to fs key X-Git-Tag: upstream/23.3.3~9692 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=420f2c0878f0c38128854f2adbbeb1391e752cb8;p=platform%2Fupstream%2Fmesa.git zink: add `single_sample` to fs key This key will be 1 when a multisampled buffer is used without multisampling enabled. This requires a lowering pass. Reviewed-By: Mike Blumenkrantz Part-of: --- diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index 7d39a94..2aca3fc 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -492,6 +492,8 @@ zink_draw(struct pipe_context *pctx, zink_set_primitive_emulation_keys(ctx); } + zink_update_fs_key_single_sample(ctx); + if (index_size) { const VkIndexType index_type[3] = { VK_INDEX_TYPE_UINT8_EXT, diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 6dbe7e6..9aea8fb 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -2388,3 +2388,12 @@ zink_set_primitive_emulation_keys(struct zink_context *ctx) ctx->gfx_stages[MESA_SHADER_GEOMETRY]->non_fs.is_generated) ctx->base.bind_gs_state(&ctx->base, NULL); } + +void +zink_update_fs_key_single_sample(struct zink_context *ctx) +{ + bool single_sample = ctx->rast_state && !ctx->rast_state->base.multisample && + ctx->gfx_pipeline_state.rast_samples != 0; + if (zink_get_fs_base_key(ctx)->single_sample != single_sample) + zink_set_fs_base_key(ctx)->single_sample = single_sample; +} diff --git a/src/gallium/drivers/zink/zink_program.h b/src/gallium/drivers/zink/zink_program.h index bf78d19..459b1ee 100644 --- a/src/gallium/drivers/zink/zink_program.h +++ b/src/gallium/drivers/zink/zink_program.h @@ -316,6 +316,9 @@ void zink_update_fs_key_samples(struct zink_context *ctx); void +zink_update_fs_key_single_sample(struct zink_context *ctx); + +void zink_update_gs_key_rectangular_line(struct zink_context *ctx); static inline struct zink_vs_key * diff --git a/src/gallium/drivers/zink/zink_shader_keys.h b/src/gallium/drivers/zink/zink_shader_keys.h index c7e0615..79305c3 100644 --- a/src/gallium/drivers/zink/zink_shader_keys.h +++ b/src/gallium/drivers/zink/zink_shader_keys.h @@ -85,7 +85,8 @@ struct zink_fs_key_base { bool force_persample_interp : 1; bool fbfetch_ms : 1; bool shadow_needs_shader_swizzle : 1; //append zink_zs_swizzle_key after the key data - uint8_t pad : 2; + bool single_sample: 1; + uint8_t pad : 1; uint8_t coord_replace_bits; };