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 <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22626>
This commit is contained in:
antonino 2023-04-20 15:18:23 +02:00 committed by Marge Bot
parent d2ccdc3e8d
commit 420f2c0878
4 changed files with 16 additions and 1 deletions

View file

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

View file

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

View file

@ -315,6 +315,9 @@ zink_get_tcs_key(const struct zink_context *ctx)
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);

View file

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