[Mesa-dev] [PATCH 3/3] nouveau: only enable stencil func if the visual has stencil bits

Francisco Jerez currojerez at riseup.net
Sat Aug 16 10:56:19 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 | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
> index f58caa3..2a77424 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
> @@ -118,6 +118,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);
> +	context_dirty(ctx, STENCIL_FUNC);
>  }
>  
>  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 d34cf91..23e2700 100644
> --- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
> +++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
> @@ -143,9 +143,10 @@ void
>  nv10_emit_stencil_func(struct gl_context *ctx, int emit)
>  {
>  	struct nouveau_pushbuf *push = context_push(ctx);
> +	struct gl_framebuffer *fb = ctx->DrawBuffer;
>  
>  	BEGIN_NV04(push, NV10_3D(STENCIL_ENABLE), 1);
> -	PUSH_DATAb(push, ctx->Stencil.Enabled);
> +	PUSH_DATAb(push, ctx->Stencil.Enabled && fb->Visual.stencilBits > 0);

We should probably just use ctx->Stencil._Enabled here.  Otherwise looks
OK to me.

>  
>  	BEGIN_NV04(push, NV10_3D(STENCIL_FUNC_FUNC), 3);
>  	PUSH_DATA (push, nvgl_comparison_op(ctx->Stencil.Function[0]));
> -- 
> 1.8.5.5
-------------- 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/566b0ebc/attachment.sig>


More information about the mesa-dev mailing list