operations.
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;
_swrast_span_default_texcoords(ctx, &span);
if (type == GL_UNSIGNED_SHORT
- && rb->DepthBits == 16
+ && ctx->DrawBuffer->Visual.depthBits == 16
&& !scaleOrBias
&& !zoom
&& ctx->Visual.rgbMode
&& 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 *)
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;
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;
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;
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;
}
}
}
- 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;
_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;
}
/* 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);
}
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);