diff options
author | Brian Paul <[email protected]> | 2002-03-16 00:53:15 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2002-03-16 00:53:15 +0000 |
commit | 18a285a5e244b7405b85feb7315a30d99920ec5d (patch) | |
tree | 02fbfa95292ef56eef26bb2e8456f65cf1348f18 /src/mesa/swrast/s_depth.c | |
parent | 8d687e7e58a148f3f16573636023e54755372010 (diff) |
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().
Diffstat (limited to 'src/mesa/swrast/s_depth.c')
-rw-r--r-- | src/mesa/swrast/s_depth.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index a62926cc42b..cadb0ecd109 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"); } } } |