summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-01-16 10:54:47 -0700
committerIan Romanick <[email protected]>2012-01-27 17:43:21 -0800
commit7c6f54811c7c1843f862ab4986431527f56a6db1 (patch)
tree49ac0d056763f762e41d471198e8b0423a0b3c90 /src/mesa/swrast
parenta42dcf1614cae7a1f896eb934c99c78dfd36c1d8 (diff)
swrast: use _swrast_pixel_address() in more places
(cherry picked from commit e34a54ff451a37a6e6eab529c44330dd6a8b218b)
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_depth.c20
-rw-r--r--src/mesa/swrast/s_stencil.c2
2 files changed, 15 insertions, 7 deletions
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 42724c72b8e..440c43ffa41 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -213,7 +213,7 @@ get_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint zbuffer[])
{
const GLint w = rb->Width, h = rb->Height;
- const GLubyte *map = (const GLubyte *) rb->Data;
+ const GLubyte *map = _swrast_pixel_address(rb, 0, 0);
GLuint i;
if (rb->Format == MESA_FORMAT_Z32) {
@@ -247,7 +247,7 @@ put_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
const GLuint zvalues[], const GLubyte mask[])
{
const GLint w = rb->Width, h = rb->Height;
- GLubyte *map = (GLubyte *) rb->Data;
+ GLubyte *map = _swrast_pixel_address(rb, 0, 0);
GLuint i;
if (rb->Format == MESA_FORMAT_Z32) {
@@ -283,7 +283,7 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span)
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
const GLint bpp = _mesa_get_format_bytes(rb->Format);
- void *zStart = _swrast_pixel_address(rb, span->x, span->y);
+ void *zStart;
const GLuint count = span->end;
const GLuint *fragZ = span->array->z;
GLubyte *mask = span->array->mask;
@@ -293,6 +293,11 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span)
GLuint zBits = _mesa_get_format_bits(rb->Format, GL_DEPTH_BITS);
GLboolean ztest16 = GL_FALSE;
+ if (span->arrayMask & SPAN_XY)
+ zStart = NULL;
+ else
+ zStart = _swrast_pixel_address(rb, span->x, span->y);
+
if (rb->Format == MESA_FORMAT_Z16 && !(span->arrayMask & SPAN_XY)) {
/* directly read/write row of 16-bit Z values */
zBufferVals = zStart;
@@ -405,9 +410,7 @@ _swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span )
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
- const GLint bpp = _mesa_get_format_bytes(rb->Format);
- const GLint rowStride = rb->RowStride * bpp;
- GLubyte *zStart = (GLubyte*) rb->Data + span->y * rowStride + span->x * bpp;
+ GLubyte *zStart;
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;
@@ -417,6 +420,11 @@ _swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span )
GLuint zBufferTemp[MAX_WIDTH];
const GLuint *zBufferVals;
+ if (span->arrayMask & SPAN_XY)
+ zStart = NULL;
+ else
+ zStart = _swrast_pixel_address(rb, span->x, span->y);
+
if (rb->Format == MESA_FORMAT_Z32 && !(span->arrayMask & SPAN_XY)) {
/* directly access 32-bit values in the depth buffer */
zBufferVals = (const GLuint *) zStart;
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c
index fb95ef14df3..98af928208c 100644
--- a/src/mesa/swrast/s_stencil.c
+++ b/src/mesa/swrast/s_stencil.c
@@ -293,7 +293,7 @@ get_s8_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLubyte stencil[])
{
const GLint w = rb->Width, h = rb->Height;
- const GLubyte *map = (const GLubyte *) rb->Data;
+ const GLubyte *map = _swrast_pixel_address(rb, 0, 0);
GLuint i;
if (rb->Format == MESA_FORMAT_S8) {