[Mesa-dev] [PATCH] i830_state:i830Enable(): Fix crash for GL_STENCIL_TEST

Brian Paul brian.e.paul at gmail.com
Tue May 29 07:53:12 PDT 2012


On Fri, May 25, 2012 at 5:26 PM, Kurt Roeckx <kurt at roeckx.be> wrote:
> Can someone please review and commit this?  A lot of the piglit
> tests fail because of this.
>
>
> Kurt
>
> On Fri, May 11, 2012 at 12:19:42AM +0200, Kurt Roeckx wrote:
>> commit 87f12bb2d95236c7b025d1a8be56b5ab1683d702 tried to fix rb->mt
>> being NULL, but change this case wrong.
>>
>> Note: this is a candidate for the 8.0 branch
>>
>> Signed-off-by: Kurt Roeckx <kurt at roeckx.be>
>> ---
>>  src/mesa/drivers/dri/i915/i830_state.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c
>> index 6f8bd69..647ba62 100644
>> --- a/src/mesa/drivers/dri/i915/i830_state.c
>> +++ b/src/mesa/drivers/dri/i915/i830_state.c
>> @@ -862,7 +862,7 @@ i830Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
>>           if (ctx->DrawBuffer) {
>>              struct intel_renderbuffer *irbStencil
>>                 = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL);
>> -            hw_stencil = (irbStencil && irbStencil->mt->region);
>> +            hw_stencil = (irbStencil && irbStencil->mt);

I would think that you should test all three pointers to be safe:

hw_stencil = irbStencil && irbStencil->mt && irbStencil->mt->region;

I can commit that change later if there's no objections.

-Brian


More information about the mesa-dev mailing list