Use new gl_framebuffer _Depth/_StencilBuffer fields instead of
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 16 Nov 2005 04:09:26 +0000 (04:09 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 16 Nov 2005 04:09:26 +0000 (04:09 +0000)
Attachment[BUFFER_DEPTH/STENCIL].Renderbuffer.  The former may be wrappers
around combined depth/stencil renderbuffers attached at the later points.

src/mesa/main/teximage.c
src/mesa/swrast/s_buffers.c
src/mesa/swrast/s_copypix.c
src/mesa/swrast/s_depth.c
src/mesa/swrast/s_drawpix.c
src/mesa/swrast/s_readpix.c
src/mesa/swrast/s_stencil.c
src/mesa/swrast/s_texstore.c
src/mesa/swrast/s_triangle.c
src/mesa/swrast/s_zoom.c

index 419df0f090eca88a357f992c8fa2ac99149cd66d..cb0e1884d701755bef1026a9d75237ce1192e7bd 100644 (file)
@@ -1792,7 +1792,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
    }
    else if (is_depth_format(internalFormat)) {
       /* make sure we have depth/stencil buffers */
-      if (!ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer) {
+      if (!ctx->ReadBuffer->_DepthBuffer) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glCopyTexImage%D(no depth)", dimensions);
          return GL_TRUE;
@@ -1800,8 +1800,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
    }
    else if (is_depthstencil_format(internalFormat)) {
       /* make sure we have depth/stencil buffers */
-      if (!ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer ||
-          !ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer) {
+      if (!ctx->ReadBuffer->_DepthBuffer || !ctx->ReadBuffer->_StencilBuffer) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glCopyTexImage%D(no depth/stencil buffer)", dimensions);
          return GL_TRUE;
@@ -1969,7 +1968,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
    }
 
    if (teximage->_BaseFormat == GL_DEPTH_COMPONENT) {
-      if (!ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer) {
+      if (!ctx->ReadBuffer->_DepthBuffer) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glCopyTexSubImage%D(no depth buffer)",
                      dimensions);
@@ -1977,8 +1976,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
       }
    }
    else if (teximage->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
-      if (!ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer ||
-          !ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer) {
+      if (!ctx->ReadBuffer->_DepthBuffer || !ctx->ReadBuffer->_StencilBuffer) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glCopyTexSubImage%D(no depth/stencil buffer)",
                      dimensions);
index b9f20c05c4958e1c71669ecbd8ad097e1ba63a30..9dace65860ad06d3a07963df797fc623598534d4 100644 (file)
@@ -293,19 +293,14 @@ _swrast_Clear(GLcontext *ctx, GLbitfield mask,
          clear_color_buffers(ctx);
       }
       if (mask & BUFFER_BIT_DEPTH) {
-         struct gl_renderbuffer *rb
-            = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
-         _swrast_clear_depth_buffer(ctx, rb);
+         _swrast_clear_depth_buffer(ctx, ctx->DrawBuffer->_DepthBuffer);
       }
       if (mask & BUFFER_BIT_ACCUM) {
-         struct gl_renderbuffer *rb
-            = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
-         _swrast_clear_accum_buffer(ctx, rb);
+         _swrast_clear_accum_buffer(ctx,
+                       ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer);
       }
       if (mask & BUFFER_BIT_STENCIL) {
-         struct gl_renderbuffer *rb
-            = ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
-         _swrast_clear_stencil_buffer(ctx, rb);
+         _swrast_clear_stencil_buffer(ctx, ctx->DrawBuffer->_StencilBuffer);
       }
    }
 
index f93cb536851637736fd15236ca4010f80136af4a..48c36120bc7e0f187cad861aaf6a1b3c756de27d 100644 (file)
@@ -501,7 +501,7 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    struct gl_framebuffer *fb = ctx->ReadBuffer;
-   struct gl_renderbuffer *readRb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
+   struct gl_renderbuffer *readRb = fb->_DepthBuffer;
    const GLfloat depthMax = fb->_DepthMaxF;
    GLfloat *p, *tmpImage;
    GLint sy, dy, stepy;
@@ -610,7 +610,7 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
                      GLint destx, GLint desty )
 {
    struct gl_framebuffer *fb = ctx->ReadBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_StencilBuffer;
    GLint sy, dy, stepy;
    GLint j;
    GLstencil *p, *tmpImage;
@@ -724,9 +724,9 @@ copy_depth_stencil_pixels(GLcontext *ctx,
       = ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0;
    GLint overlapping;
 
-   depthDrawRb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
-   depthReadRb = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
-   stencilReadRb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
+   depthDrawRb = ctx->DrawBuffer->_DepthBuffer;
+   depthReadRb = ctx->ReadBuffer->_DepthBuffer;
+   stencilReadRb = ctx->ReadBuffer->_StencilBuffer;
 
    ASSERT(depthDrawRb);
    ASSERT(depthReadRb);
index 800e7f29fddcf20d7ed53d95ac179d59cd2837af..27a77b14af7e21b24368b03656eae5cb099e0608 100644 (file)
@@ -506,7 +506,7 @@ static GLuint
 depth_test_span( GLcontext *ctx, struct sw_span *span)
 {
    struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_DepthBuffer;
    const GLint x = span->x;
    const GLint y = span->y;
    const GLuint count = span->end;
@@ -1053,7 +1053,7 @@ static GLuint
 depth_test_pixels( GLcontext *ctx, struct sw_span *span )
 {
    struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_DepthBuffer;
    const GLuint count = span->end;
    const GLint *x = span->array->x;
    const GLint *y = span->array->y;
@@ -1119,7 +1119,7 @@ GLboolean
 _swrast_depth_bounds_test( GLcontext *ctx, struct sw_span *span )
 {
    struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_DepthBuffer;
    GLuint zMin = (GLuint) (ctx->Depth.BoundsMin * fb->_DepthMaxF + 0.5F);
    GLuint zMax = (GLuint) (ctx->Depth.BoundsMax * fb->_DepthMaxF + 0.5F);
    GLubyte *mask = span->array->mask;
index b60004b1d68a58452d5593e5d6290525d5856a23..d1f2ad8b8372a650eb78e9d188a9590fb3c6eb70 100644 (file)
@@ -842,8 +842,8 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
    struct gl_pixelstore_attrib clippedUnpack = *unpack;
    GLint i;
 
-   depthRb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
-   stencilRb = ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
+   depthRb = ctx->DrawBuffer->_DepthBuffer;
+   stencilRb = ctx->DrawBuffer->_StencilBuffer;
 
    ASSERT(depthRb);
    ASSERT(stencilRb);
index 1d83dbf1dcfdd52c069b2ac54d6e49ab1f07590f..ace8519d610d7db76a25983ab0084df628cca156 100644 (file)
@@ -86,7 +86,7 @@ read_depth_pixels( GLcontext *ctx,
                    const struct gl_pixelstore_attrib *packing )
 {
    struct gl_framebuffer *fb = ctx->ReadBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_DepthBuffer;
    GLboolean bias_or_scale;
 
    /* clipping should have been done already */
@@ -168,7 +168,7 @@ read_stencil_pixels( GLcontext *ctx,
                      const struct gl_pixelstore_attrib *packing )
 {
    struct gl_framebuffer *fb = ctx->ReadBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_StencilBuffer;
    GLint j;
 
    ASSERT(rb);
@@ -422,8 +422,8 @@ read_depth_stencil_pixels(GLcontext *ctx,
    struct gl_renderbuffer *depthRb, *stencilRb;
    GLint i;
 
-   depthRb = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
-   stencilRb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
+   depthRb = ctx->ReadBuffer->_DepthBuffer;
+   stencilRb = ctx->ReadBuffer->_StencilBuffer;
 
    ASSERT(depthRb);
    ASSERT(stencilRb);
index 09dd4ef88378f4174adbb23ed0a79673e5306214..effe4a6a52fc1201fee1988e28b7434f1c043bbc 100644 (file)
@@ -409,7 +409,7 @@ static GLboolean
 stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span, GLuint face)
 {
    struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_StencilBuffer;
    GLstencil stencilRow[MAX_WIDTH];
    GLstencil *stencil;
    const GLuint n = span->end;
@@ -532,7 +532,7 @@ apply_stencil_op_to_pixels( GLcontext *ctx,
                             GLenum oper, GLuint face, const GLubyte mask[] )
 {
    struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_StencilBuffer;
    const GLstencil stencilMax = (1 << fb->Visual.stencilBits) - 1;
    const GLstencil ref = ctx->Stencil.Ref[face];
    const GLstencil wrtmask = ctx->Stencil.WriteMask[face];
@@ -705,7 +705,7 @@ stencil_test_pixels( GLcontext *ctx, GLuint face, GLuint n,
                      const GLint x[], const GLint y[], GLubyte mask[] )
 {
    const struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_StencilBuffer;
    GLubyte fail[MAX_WIDTH];
    GLstencil r, s;
    GLuint i;
@@ -903,7 +903,7 @@ static GLboolean
 stencil_and_ztest_pixels( GLcontext *ctx, struct sw_span *span, GLuint face )
 {
    struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_StencilBuffer;
    const GLuint n = span->end;
    const GLint *x = span->array->x;
    const GLint *y = span->array->y;
@@ -1099,7 +1099,7 @@ _swrast_write_stencil_span(GLcontext *ctx, GLint n, GLint x, GLint y,
                            const GLstencil stencil[] )
 {
    struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+   struct gl_renderbuffer *rb = fb->_StencilBuffer;
    const GLuint stencilMax = (1 << fb->Visual.stencilBits) - 1;
    const GLuint stencilMask = ctx->Stencil.WriteMask[0];
 
index ff1f9d9992d287088d176af4611c81b966402648..a3e695549eb0978ccac837432b10fd819af94a3a 100644 (file)
@@ -94,8 +94,7 @@ static GLfloat *
 read_depth_image( GLcontext *ctx, GLint x, GLint y,
                   GLsizei width, GLsizei height )
 {
-   struct gl_renderbuffer *rb
-      = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
+   struct gl_renderbuffer *rb = ctx->ReadBuffer->_DepthBuffer;
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    GLfloat *image, *dst;
    GLint i;
@@ -125,10 +124,8 @@ static GLuint *
 read_depth_stencil_image(GLcontext *ctx, GLint x, GLint y,
                          GLsizei width, GLsizei height)
 {
-   struct gl_renderbuffer *depthRb
-      = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
-   struct gl_renderbuffer *stencilRb
-      = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
+   struct gl_renderbuffer *depthRb = ctx->ReadBuffer->_DepthBuffer;
+   struct gl_renderbuffer *stencilRb = ctx->ReadBuffer->_StencilBuffer;
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    GLuint *image, *dst;
    GLint i;
index c364b0b0e84eb764c396685f112c322af43f0cef..1e3d76874a3ce3cf99cad5993ee6fca39dd971be 100644 (file)
@@ -905,8 +905,7 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span,
 #define NAME occlusion_zless_triangle
 #define INTERP_Z 1
 #define SETUP_CODE                                                     \
-   struct gl_renderbuffer *rb                                          \
-      = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;                \
+   struct gl_renderbuffer *rb = ctx->DrawBuffer->_DepthBuffer;         \
    struct gl_query_object *q = ctx->Query.CurrentOcclusionObject;      \
    ASSERT(ctx->Depth.Test);                                            \
    ASSERT(!ctx->Depth.Mask);                                           \
index 41feb1140c53e8e90bfe108d36c83fd1055a7221..3fd914083f9e7466f875f731833add820eb8f433 100644 (file)
@@ -355,8 +355,7 @@ _swrast_write_zoomed_z_span(GLcontext *ctx, GLint imgX, GLint imgY,
                             GLint width, GLint spanX, GLint spanY,
                             const GLvoid *z)
 {
-   struct gl_renderbuffer *rb
-      = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
+   struct gl_renderbuffer *rb = ctx->DrawBuffer->_DepthBuffer;
    GLushort zoomedVals16[MAX_WIDTH];
    GLuint zoomedVals32[MAX_WIDTH];
    GLint x0, x1, y0, y1, y;