zink: flag shaders as needing update when clip_halfz changes

this means we may or may not need to run the nir pass in the shader,
so force this to go back through the update path using the shader key

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8682>
This commit is contained in:
Mike Blumenkrantz 2020-08-18 15:06:15 -04:00 committed by Marge Bot
parent 03971d8ddc
commit 9b8c121917
4 changed files with 17 additions and 2 deletions

View file

@ -338,8 +338,10 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, struct z
if (zs->streamout.so_info_slots)
streamout = &zs->streamout;
nir = nir_shader_clone(NULL, zs->nir);
NIR_PASS_V(nir, nir_lower_clip_halfz);
if (!zink_vs_key(key)->clip_halfz) {
nir = nir_shader_clone(NULL, zs->nir);
NIR_PASS_V(nir, nir_lower_clip_halfz);
}
}
} else {
if (!zink_fs_key(key)->samples &&

View file

@ -121,6 +121,7 @@ struct zink_context {
struct zink_gfx_program *curr_program;
unsigned dirty_shader_stages : 6; /* mask of changed shader stages */
bool last_vertex_stage_dirty;
struct hash_table *render_pass_cache;

View file

@ -162,6 +162,14 @@ zink_bind_vertex_buffers(struct zink_batch *batch, struct zink_context *ctx)
static struct zink_gfx_program *
get_gfx_program(struct zink_context *ctx)
{
if (ctx->last_vertex_stage_dirty) {
if (ctx->gfx_stages[PIPE_SHADER_GEOMETRY])
ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_GEOMETRY);
else if (ctx->gfx_stages[PIPE_SHADER_TESS_EVAL])
ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_TESS_EVAL);
else
ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_VERTEX);
}
if (ctx->dirty_shader_stages) {
struct hash_entry *entry = _mesa_hash_table_search(ctx->program_cache,
ctx->gfx_stages);

View file

@ -464,6 +464,7 @@ static void
zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
{
struct zink_context *ctx = zink_context(pctx);
bool clip_halfz = ctx->rast_state ? ctx->rast_state->base.clip_halfz : false;
ctx->rast_state = cso;
if (ctx->rast_state) {
@ -472,6 +473,9 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
ctx->gfx_pipeline_state.dirty = true;
}
if (clip_halfz != ctx->rast_state->base.clip_halfz)
ctx->last_vertex_stage_dirty = true;
if (ctx->line_width != ctx->rast_state->line_width) {
ctx->line_width = ctx->rast_state->line_width;
ctx->gfx_pipeline_state.dirty = true;