zink: move sample part of fs key to renderpass

this is more accurate

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12660>
This commit is contained in:
Mike Blumenkrantz 2021-06-24 10:40:20 -04:00 committed by Marge Bot
parent 43cfd97ade
commit ad45e351a2
3 changed files with 6 additions and 2 deletions

View file

@ -1543,6 +1543,7 @@ get_render_pass(struct zink_context *ctx)
struct zink_render_pass_state state = {0};
uint32_t clears = 0;
state.swapchain_init = ctx->new_swapchain;
state.samples = fb->samples > 0;
u_foreach_bit(i, ctx->fbfetch_outputs)
state.rts[i].fbfetch = true;
@ -1598,6 +1599,7 @@ get_render_pass(struct zink_context *ctx)
assert(rp->state.clears == clears);
} else {
struct zink_render_pass_pipeline_state pstate;
pstate.samples = state.samples;
rp = zink_create_render_pass(screen, &state, &pstate);
if (!_mesa_hash_table_insert_pre_hashed(ctx->render_pass_cache, hash, &rp->state, rp))
return NULL;

View file

@ -141,7 +141,7 @@ shader_key_fs_gen(struct zink_context *ctx, struct zink_shader *zs,
* in VK, gl_SampleMask[] is never ignored
*/
if (zs->nir->info.outputs_written & (1 << FRAG_RESULT_SAMPLE_MASK))
fs_key->samples = !!ctx->fb_state.samples;
fs_key->samples = ctx->gfx_pipeline_state.render_pass->state.samples;
fs_key->force_dual_color_blend = screen->driconf.dual_color_blend_by_location &&
ctx->gfx_pipeline_state.blend_state &&
ctx->gfx_pipeline_state.blend_state->dual_src_blend &&

View file

@ -46,6 +46,7 @@ struct zink_rt_attrib {
struct zink_render_pass_state {
uint8_t num_cbufs : 4; /* PIPE_MAX_COLOR_BUFS = 8 */
uint8_t have_zsbuf : 1;
bool samples; //for fs samplemask
bool swapchain_init;
struct zink_rt_attrib rts[PIPE_MAX_COLOR_BUFS + 1];
unsigned num_rts;
@ -58,7 +59,8 @@ struct zink_pipeline_rt {
};
struct zink_render_pass_pipeline_state {
uint32_t num_attachments;
uint32_t num_attachments:31;
bool samples:1; //for fs samplemask
struct zink_pipeline_rt attachments[PIPE_MAX_COLOR_BUFS + 1];
unsigned id;
};