summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_drawpix.c10
-rw-r--r--src/mesa/swrast/s_readpix.c9
-rw-r--r--src/mesa/swrast/s_texstore.c8
3 files changed, 13 insertions, 14 deletions
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 7c799101d12..ce398b2b7f7 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -561,8 +561,6 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels )
{
- struct gl_renderbuffer *rb
- = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
const GLboolean scaleOrBias
= ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0;
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0;
@@ -578,7 +576,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
_swrast_span_default_texcoords(ctx, &span);
if (type == GL_UNSIGNED_SHORT
- && rb->DepthBits == 16
+ && ctx->DrawBuffer->Visual.depthBits == 16
&& !scaleOrBias
&& !zoom
&& ctx->Visual.rgbMode
@@ -604,7 +602,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
&& ctx->Visual.rgbMode
&& width <= MAX_WIDTH) {
/* Special case: shift 32-bit values down to Visual.depthBits */
- const GLint shift = 32 - rb->DepthBits;
+ const GLint shift = 32 - ctx->DrawBuffer->Visual.depthBits;
GLint row;
for (row = 0; row < height; row++) {
const GLuint *zSrc = (const GLuint *)
@@ -867,7 +865,7 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
GL_DEPTH_STENCIL_EXT, type, i, 0);
if (ctx->Depth.Mask) {
- if (!scaleOrBias && depthRb->DepthBits == 24) {
+ if (!scaleOrBias && ctx->DrawBuffer->Visual.depthBits == 24) {
/* fast path 24-bit zbuffer */
GLuint zValues[MAX_WIDTH];
GLint j;
@@ -881,7 +879,7 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
else
depthRb->PutRow(ctx, depthRb, width, x, y + i, zValues, NULL);
}
- else if (!scaleOrBias && depthRb->DepthBits == 16) {
+ else if (!scaleOrBias && ctx->DrawBuffer->Visual.depthBits == 16) {
/* fast path 16-bit zbuffer */
GLushort zValues[MAX_WIDTH];
GLint j;
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 870242e8557..1d83dbf1dcf 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -101,7 +101,7 @@ read_depth_pixels( GLcontext *ctx,
bias_or_scale = ctx->Pixel.DepthBias != 0.0 || ctx->Pixel.DepthScale != 1.0;
- if (type == GL_UNSIGNED_SHORT && rb->DepthBits == 16
+ if (type == GL_UNSIGNED_SHORT && fb->Visual.depthBits == 16
&& !bias_or_scale && !packing->SwapBytes) {
/* Special case: directly read 16-bit unsigned depth values. */
GLint j;
@@ -113,7 +113,7 @@ read_depth_pixels( GLcontext *ctx,
rb->GetRow(ctx, rb, width, x, y, dest);
}
}
- else if (type == GL_UNSIGNED_INT && rb->DepthBits == 24
+ else if (type == GL_UNSIGNED_INT && fb->Visual.depthBits == 24
&& !bias_or_scale && !packing->SwapBytes) {
/* Special case: directly read 24-bit unsigned depth values. */
GLint j;
@@ -131,7 +131,7 @@ read_depth_pixels( GLcontext *ctx,
}
}
}
- else if (type == GL_UNSIGNED_INT && rb->DepthBits == 32
+ else if (type == GL_UNSIGNED_INT && fb->Visual.depthBits == 32
&& !bias_or_scale && !packing->SwapBytes) {
/* Special case: directly read 32-bit unsigned depth values. */
GLint j;
@@ -437,7 +437,8 @@ read_depth_stencil_pixels(GLcontext *ctx,
_swrast_read_stencil_span(ctx, stencilRb, width, x, y + i, stencilVals);
- if (!scaleOrBias && !stencilTransfer && depthRb->DepthBits == 24) {
+ if (!scaleOrBias && !stencilTransfer
+ && ctx->ReadBuffer->Visual.depthBits == 24) {
/* ideal case */
GLuint zVals[MAX_WIDTH]; /* 24-bit values! */
GLint j;
diff --git a/src/mesa/swrast/s_texstore.c b/src/mesa/swrast/s_texstore.c
index fce20011d2a..c0da83eb9fe 100644
--- a/src/mesa/swrast/s_texstore.c
+++ b/src/mesa/swrast/s_texstore.c
@@ -164,13 +164,13 @@ read_depth_stencil_image(GLcontext *ctx, GLint x, GLint y,
}
/* put depth values into bits 0xffffff00 */
- if (depthRb->DepthBits == 24) {
+ if (ctx->ReadBuffer->Visual.depthBits == 24) {
GLint j;
for (j = 0; j < width * height; j++) {
image[j] <<= 8;
}
}
- else if (depthRb->DepthBits == 16) {
+ else if (ctx->ReadBuffer->Visual.depthBits == 16) {
GLint j;
for (j = 0; j < width * height; j++) {
image[j] = (image[j] << 16) | (image[j] & 0xff00);
@@ -178,8 +178,8 @@ read_depth_stencil_image(GLcontext *ctx, GLint x, GLint y,
}
else {
/* this handles arbitrary depthBits >= 12 */
- GLint lShift = 32 - depthRb->DepthBits;
- GLint rShift = depthRb->DepthBits;
+ const GLint rShift = ctx->ReadBuffer->Visual.depthBits;
+ const GLint lShift = 32 - rShift;
GLint j;
for (j = 0; j < width * height; j++) {
GLuint z = (image[j] << lShift);