From 18a285a5e244b7405b85feb7315a30d99920ec5d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 16 Mar 2002 00:53:15 +0000 Subject: Lots of changes related to framebuffer/window buffer resizing. Basically, instead of passing a GLcontext* to ResizeBuffers(), pass a GLframebuffer*. The idea is that a window can be resized without it being bound to a rendering context. This makes for a nice clean-up in the XFree86 server-side GLX code. Renamed ctx->Driver.ResizeBuffersMESA() to ctx->Driver.ResizeBuffers(). --- src/mesa/swrast/s_depth.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'src/mesa/swrast/s_depth.c') diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index a62926cc42..cadb0ecd10 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -1,4 +1,4 @@ -/* $Id: s_depth.c,v 1.17 2002/02/06 03:22:00 brianp Exp $ */ +/* $Id: s_depth.c,v 1.18 2002/03/16 00:53:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1513,32 +1513,33 @@ _mesa_read_depth_span_float( GLcontext *ctx, * This function is only called through Driver.alloc_depth_buffer. */ void -_mesa_alloc_depth_buffer( GLcontext *ctx ) +_mesa_alloc_depth_buffer( GLframebuffer *buffer ) { - /* deallocate current depth buffer if present */ - if (ctx->DrawBuffer->UseSoftwareDepthBuffer) { - GLint bytesPerValue; + GLint bytesPerValue; - if (ctx->DrawBuffer->DepthBuffer) { - FREE(ctx->DrawBuffer->DepthBuffer); - ctx->DrawBuffer->DepthBuffer = NULL; - } + ASSERT(buffer->UseSoftwareDepthBuffer); - /* allocate new depth buffer, but don't initialize it */ - if (ctx->Visual.depthBits <= 16) - bytesPerValue = sizeof(GLushort); - else - bytesPerValue = sizeof(GLuint); + /* deallocate current depth buffer if present */ + if (buffer->DepthBuffer) { + FREE(buffer->DepthBuffer); + buffer->DepthBuffer = NULL; + } + + /* allocate new depth buffer, but don't initialize it */ + if (buffer->Visual.depthBits <= 16) + bytesPerValue = sizeof(GLushort); + else + bytesPerValue = sizeof(GLuint); - ctx->DrawBuffer->DepthBuffer = MALLOC( ctx->DrawBuffer->Width - * ctx->DrawBuffer->Height - * bytesPerValue ); + buffer->DepthBuffer =MALLOC(buffer->Width * buffer->Height * bytesPerValue); - if (!ctx->DrawBuffer->DepthBuffer) { - /* out of memory */ + if (!buffer->DepthBuffer) { + /* out of memory */ + GET_CURRENT_CONTEXT(ctx); + if (ctx) { ctx->Depth.Test = GL_FALSE; ctx->NewState |= _NEW_DEPTH; - _mesa_error( ctx, GL_OUT_OF_MEMORY, "Couldn't allocate depth buffer" ); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "Couldn't allocate depth buffer"); } } } -- cgit v1.2.3