diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/swrast/s_copypix.c | 16 | ||||
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 11 | ||||
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 29 |
3 files changed, 29 insertions, 27 deletions
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index caf68ecd9d..2b4e8450d9 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -500,9 +500,9 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty ) { - const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; - struct gl_renderbuffer *readRb - = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; + struct gl_framebuffer *fb = ctx->ReadBuffer; + struct gl_renderbuffer *readRb = fb->Attachment[BUFFER_DEPTH].Renderbuffer; + const GLfloat depthMax = fb->_DepthMaxF; GLfloat *p, *tmpImage; GLint sy, dy, stepy; GLint i, j; @@ -517,7 +517,7 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); - if (!ctx->Visual.depthBits) { + if (fb->Visual.depthBits == 0) { _mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); return; } @@ -588,7 +588,7 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, span.x = destx; span.y = dy; span.end = width; - if (ctx->Visual.rgbMode) { + if (fb->Visual.rgbMode) { if (zoom) _swrast_write_zoomed_rgba_span( ctx, &span, (const GLchan (*)[4])span.array->rgba, desty, 0 ); @@ -614,8 +614,8 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty ) { - struct gl_renderbuffer *rb - = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; + struct gl_framebuffer *fb = ctx->ReadBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; GLint sy, dy, stepy; GLint j; GLstencil *p, *tmpImage; @@ -623,7 +623,7 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; GLint overlapping; - if (!ctx->Visual.stencilBits) { + if (fb->Visual.stencilBits == 0) { _mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); return; } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 5f4ea7f8ba..91ac13b13b 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -529,8 +529,8 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, return; } - if (ctx->Visual.stencilBits == 0) { - _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawPixels(no stencil buffer)"); + if (ctx->DrawBuffer->Visual.stencilBits == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(no stencil buffer)"); return; } @@ -584,6 +584,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { + struct gl_framebuffer *fb = ctx->DrawBuffer; const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0; const GLint desty = y; @@ -610,7 +611,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, _swrast_span_default_texcoords(ctx, &span); if (type == GL_UNSIGNED_SHORT - && ctx->Visual.depthBits == 16 + && fb->Visual.depthBits == 16 && !bias_or_scale && !zoom && ctx->Visual.rgbMode @@ -635,8 +636,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, && !zoom && ctx->Visual.rgbMode && width <= MAX_WIDTH) { - /* Special case: shift 32-bit values down to ctx->Visual.depthBits */ - const GLint shift = 32 - ctx->Visual.depthBits; + /* Special case: shift 32-bit values down to Visual.depthBits */ + const GLint shift = 32 - fb->Visual.depthBits; GLint row, spanY = y; for (row = 0; row < height; row++, spanY++) { const GLuint *zSrc = (const GLuint *) diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index ab83a2995a..9e80908ba1 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -105,8 +105,8 @@ read_depth_pixels( GLcontext *ctx, GLenum type, GLvoid *pixels, const struct gl_pixelstore_attrib *packing ) { - struct gl_renderbuffer *rb - = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; + struct gl_framebuffer *fb = ctx->ReadBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer; GLboolean bias_or_scale; /* clipping should have been done already */ @@ -118,7 +118,7 @@ read_depth_pixels( GLcontext *ctx, ASSERT(width <= MAX_WIDTH); /* Error checking */ - if (ctx->Visual.depthBits <= 0) { + if (fb->Visual.depthBits <= 0) { /* No depth buffer */ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); return; @@ -141,7 +141,7 @@ read_depth_pixels( GLcontext *ctx, bias_or_scale = ctx->Pixel.DepthBias != 0.0 || ctx->Pixel.DepthScale != 1.0; - if (type == GL_UNSIGNED_SHORT && ctx->Visual.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; @@ -153,7 +153,7 @@ read_depth_pixels( GLcontext *ctx, rb->GetRow(ctx, rb, width, x, y, dest); } } - else if (type == GL_UNSIGNED_INT && ctx->Visual.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; @@ -189,8 +189,8 @@ read_stencil_pixels( GLcontext *ctx, GLenum type, GLvoid *pixels, const struct gl_pixelstore_attrib *packing ) { - struct gl_renderbuffer *rb - = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; + struct gl_framebuffer *fb = ctx->ReadBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; GLint j; if (!rb) { @@ -210,7 +210,7 @@ read_stencil_pixels( GLcontext *ctx, return; } - if (ctx->Visual.stencilBits <= 0) { + if (fb->Visual.stencilBits <= 0) { /* No stencil buffer */ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); return; @@ -323,7 +323,8 @@ read_rgba_pixels( GLcontext *ctx, GLenum format, GLenum type, GLvoid *pixels, const struct gl_pixelstore_attrib *packing ) { - struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; + struct gl_framebuffer *fb = ctx->ReadBuffer; + struct gl_renderbuffer *rb = fb->_ColorReadBuffer; if (!rb) { /* No readbuffer is OK with GL_EXT_framebuffer_object */ @@ -400,7 +401,7 @@ read_rgba_pixels( GLcontext *ctx, dest = tmpImage; for (row = 0; row < height; row++, y++) { GLchan rgba[MAX_WIDTH][4]; - if (ctx->Visual.rgbMode) { + if (fb->Visual.rgbMode) { _swrast_read_rgba_span(ctx, rb, width, x, y, rgba); } else { @@ -447,7 +448,7 @@ read_rgba_pixels( GLcontext *ctx, for (row = 0; row < height; row++, y++) { GLchan rgba[MAX_WIDTH][4]; GLvoid *dst; - if (ctx->Visual.rgbMode) { + if (fb->Visual.rgbMode) { _swrast_read_rgba_span(ctx, rb, width, x, y, rgba); } else { @@ -461,9 +462,9 @@ read_rgba_pixels( GLcontext *ctx, } dst = _mesa_image_address2d(packing, pixels, width, height, format, type, row, 0); - if (ctx->Visual.redBits < CHAN_BITS || - ctx->Visual.greenBits < CHAN_BITS || - ctx->Visual.blueBits < CHAN_BITS) { + if (fb->Visual.redBits < CHAN_BITS || + fb->Visual.greenBits < CHAN_BITS || + fb->Visual.blueBits < CHAN_BITS) { /* Requantize the color values into floating point and go from * there. This fixes conformance failures with 16-bit color * buffers, for example. |