[Mesa-dev] [PATCH 2/3] nouveau: only enable the depth test if there actually is a depth buffer
Francisco Jerez
currojerez at riseup.net
Sat Aug 16 10:56:01 PDT 2014
Ilia Mirkin <imirkin at alum.mit.edu> writes:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
> src/mesa/drivers/dri/nouveau/nouveau_state.c | 1 +
> src/mesa/drivers/dri/nouveau/nv10_state_raster.c | 5 +++--
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
> index db4915f..f58caa3 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
> @@ -117,6 +117,7 @@ nouveau_draw_buffers(struct gl_context *ctx, GLsizei n, const GLenum *buffers)
> {
> nouveau_validate_framebuffer(ctx);
> context_dirty(ctx, FRAMEBUFFER);
> + context_dirty(ctx, DEPTH);
> }
>
> static void
> diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
> index da414a0..d34cf91 100644
> --- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
> +++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
> @@ -97,11 +97,12 @@ void
> nv10_emit_depth(struct gl_context *ctx, int emit)
> {
> struct nouveau_pushbuf *push = context_push(ctx);
> + struct gl_framebuffer *fb = ctx->DrawBuffer;
>
> BEGIN_NV04(push, NV10_3D(DEPTH_TEST_ENABLE), 1);
> - PUSH_DATAb(push, ctx->Depth.Test);
> + PUSH_DATAb(push, ctx->Depth.Test && fb->Visual.depthBits > 0);
> BEGIN_NV04(push, NV10_3D(DEPTH_WRITE_ENABLE), 1);
> - PUSH_DATAb(push, ctx->Depth.Mask);
> + PUSH_DATAb(push, ctx->Depth.Mask && fb->Visual.depthBits > 0);
> BEGIN_NV04(push, NV10_3D(DEPTH_FUNC), 1);
> PUSH_DATA (push, nvgl_comparison_op(ctx->Depth.Func));
> }
> --
> 1.8.5.5
Looks OK to me,
Reviewed-by: Francisco Jerez <currojerez at riseup.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140816/f9a8a4d4/attachment.sig>
More information about the mesa-dev
mailing list