[Mesa-dev] [PATCH 2/3] nouveau: only enable the depth test if there actually is a depth buffer

Ilia Mirkin imirkin at alum.mit.edu
Sat Aug 16 12:00:55 PDT 2014


On Sat, Aug 16, 2014 at 1:56 PM, Francisco Jerez <currojerez at riseup.net> wrote:
> 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>

Actually on second thought, should the context_dirty() go into
nv10_emit_framebuffer (and nv20_emit_framebuffer)?

  -ilia


More information about the mesa-dev mailing list