diff options
author | Vasily Khoruzhick <[email protected]> | 2020-01-26 10:30:17 -0800 |
---|---|---|
committer | Vasily Khoruzhick <[email protected]> | 2020-01-27 22:35:43 -0800 |
commit | fe5267d32233192b57969a19d5733e874e63bb15 (patch) | |
tree | 6c3d029a3a0b2e309738782f38cb144a1bf678df /src/gallium/drivers | |
parent | 650c68054536ceefb8d085e343b82f907127a56d (diff) |
lima: disable early-z if fragment shader uses discard
We have to disable early-z if fragment shader uses discard,
otherwise we'll get misrendering.
Reported-by: Icenowy Zheng <[email protected]>
Reviewed-by: Andreas Baierl <[email protected]>
Signed-off-by: Vasily Khoruzhick <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3570>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3570>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/lima/lima_context.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/lima/lima_draw.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/lima/lima_program.c | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/drivers/lima/lima_context.h b/src/gallium/drivers/lima/lima_context.h index 304576b7b6d..140d7f9cd95 100644 --- a/src/gallium/drivers/lima/lima_context.h +++ b/src/gallium/drivers/lima/lima_context.h @@ -55,6 +55,7 @@ struct lima_fs_shader_state { void *shader; int shader_size; int stack_size; + bool uses_discard; struct lima_bo *bo; }; diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c index 446ba3b5697..af637f4375c 100644 --- a/src/gallium/drivers/lima/lima_draw.c +++ b/src/gallium/drivers/lima/lima_draw.c @@ -1132,6 +1132,7 @@ lima_calculate_depth_test(struct pipe_depth_state *depth, struct pipe_rasterizer static void lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *info) { + struct lima_fs_shader_state *fs = ctx->fs; struct lima_render_state *render = lima_ctx_buff_alloc(ctx, lima_ctx_buff_pp_plb_rsw, sizeof(*render)); @@ -1239,11 +1240,15 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in render->textures_address = 0x00000000; /* more investigation */ - render->aux0 = 0x00000300 | (ctx->vs->varying_stride >> 3); + render->aux0 = 0x00000100 | (ctx->vs->varying_stride >> 3); render->aux1 = 0x00001000; if (ctx->blend->base.dither) render->aux1 |= 0x00002000; + /* Enable Early-Z if shader doesn't have discard */ + if (!fs->uses_discard) + render->aux0 |= 0x200; + if (ctx->tex_stateobj.num_samplers) { render->textures_address = lima_ctx_buff_va(ctx, lima_ctx_buff_pp_tex_desc, LIMA_CTX_BUFF_SUBMIT_PP); diff --git a/src/gallium/drivers/lima/lima_program.c b/src/gallium/drivers/lima/lima_program.c index 071a736624d..9b9796d588b 100644 --- a/src/gallium/drivers/lima/lima_program.c +++ b/src/gallium/drivers/lima/lima_program.c @@ -287,6 +287,8 @@ lima_create_fs_state(struct pipe_context *pctx, return NULL; } + so->uses_discard = nir->info.fs.uses_discard; + return so; } |