From f2bfc2b7d2c5ef8a54ef9c9d25bc2e4cac2b8616 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Jul 2010 14:50:29 -0600 Subject: mesa: update assertions and fix refcounting in depth/stencil renderbuffer code --- src/mesa/main/depthstencil.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c index 892520b6959..885e718a767 100644 --- a/src/mesa/main/depthstencil.c +++ b/src/mesa/main/depthstencil.c @@ -62,8 +62,8 @@ nop_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) static void delete_wrapper(struct gl_renderbuffer *rb) { - ASSERT(rb->Format == MESA_FORMAT_Z24_S8 || - rb->Format == MESA_FORMAT_S8_Z24); + ASSERT(rb->Format == MESA_FORMAT_S8 || + rb->Format == MESA_FORMAT_X8_Z24); _mesa_reference_renderbuffer(&rb->Wrapped, NULL); free(rb); } @@ -83,7 +83,9 @@ alloc_wrapper_storage(GLcontext *ctx, struct gl_renderbuffer *rb, (void) internalFormat; ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 || - dsrb->Format == MESA_FORMAT_S8_Z24); + dsrb->Format == MESA_FORMAT_Z24_X8 || + dsrb->Format == MESA_FORMAT_S8_Z24 || + dsrb->Format == MESA_FORMAT_X8_Z24); retVal = dsrb->AllocStorage(ctx, dsrb, dsrb->InternalFormat, width, height); if (retVal) { @@ -352,16 +354,21 @@ _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *z24rb; ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 || - dsrb->Format == MESA_FORMAT_S8_Z24); + dsrb->Format == MESA_FORMAT_Z24_X8 || + dsrb->Format == MESA_FORMAT_S8_Z24 || + dsrb->Format == MESA_FORMAT_X8_Z24); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); z24rb = _mesa_new_renderbuffer(ctx, 0); if (!z24rb) return NULL; + /* NOTE: need to do manual refcounting here */ z24rb->Wrapped = dsrb; + dsrb->RefCount++; + z24rb->Name = dsrb->Name; - z24rb->RefCount = 1; + z24rb->RefCount = 0; z24rb->Width = dsrb->Width; z24rb->Height = dsrb->Height; z24rb->InternalFormat = GL_DEPTH_COMPONENT24; @@ -642,9 +649,12 @@ _mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *dsrb) if (!s8rb) return NULL; + /* NOTE: need to do manual refcounting here */ s8rb->Wrapped = dsrb; + dsrb->RefCount++; + s8rb->Name = dsrb->Name; - s8rb->RefCount = 1; + s8rb->RefCount = 0; s8rb->Width = dsrb->Width; s8rb->Height = dsrb->Height; s8rb->InternalFormat = GL_STENCIL_INDEX8_EXT; -- cgit v1.2.3