summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-11-16 04:09:26 +0000
committerBrian Paul <[email protected]>2005-11-16 04:09:26 +0000
commit1a5f1bdb428ea3ded1e77796590014f89fe78f77 (patch)
treef0acd33352c709acb37c8b279a3251d3c46ebace /src
parent909e8a7abbce61de467e059d9be57a1f32a3d344 (diff)
Use new gl_framebuffer _Depth/_StencilBuffer fields instead of
Attachment[BUFFER_DEPTH/STENCIL].Renderbuffer. The former may be wrappers around combined depth/stencil renderbuffers attached at the later points.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/teximage.c10
-rw-r--r--src/mesa/swrast/s_buffers.c13
-rw-r--r--src/mesa/swrast/s_copypix.c10
-rw-r--r--src/mesa/swrast/s_depth.c6
-rw-r--r--src/mesa/swrast/s_drawpix.c4
-rw-r--r--src/mesa/swrast/s_readpix.c8
-rw-r--r--src/mesa/swrast/s_stencil.c10
-rw-r--r--src/mesa/swrast/s_texstore.c9
-rw-r--r--src/mesa/swrast/s_triangle.c3
-rw-r--r--src/mesa/swrast/s_zoom.c3
10 files changed, 32 insertions, 44 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 419df0f090e..cb0e1884d70 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -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);
diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c
index b9f20c05c49..9dace65860a 100644
--- a/src/mesa/swrast/s_buffers.c
+++ b/src/mesa/swrast/s_buffers.c
@@ -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);
}
}
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index f93cb536851..48c36120bc7 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -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);
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 800e7f29fdd..27a77b14af7 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -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;
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index b60004b1d68..d1f2ad8b837 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -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);
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 1d83dbf1dcf..ace8519d610 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -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);
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c
index 09dd4ef8837..effe4a6a52f 100644
--- a/src/mesa/swrast/s_stencil.c
+++ b/src/mesa/swrast/s_stencil.c
@@ -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];
diff --git a/src/mesa/swrast/s_texstore.c b/src/mesa/swrast/s_texstore.c
index ff1f9d9992d..a3e695549eb 100644
--- a/src/mesa/swrast/s_texstore.c
+++ b/src/mesa/swrast/s_texstore.c
@@ -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;
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index c364b0b0e84..1e3d76874a3 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -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); \
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c
index 41feb1140c5..3fd914083f9 100644
--- a/src/mesa/swrast/s_zoom.c
+++ b/src/mesa/swrast/s_zoom.c
@@ -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;