#define ATTRIB_LOOP_END } }
+/**
+ * Return the address of a pixel value in a mapped renderbuffer.
+ */
+static inline GLubyte *
+_swrast_pixel_address(struct gl_renderbuffer *rb, GLint x, GLint y)
+{
+ const GLint bpp = _mesa_get_format_bytes(rb->Format);
+ const GLint rowStride = rb->RowStride * bpp;
+ return (GLubyte *) rb->Data + y * rowStride + x * bpp;
+}
+
+
#endif
#include "main/macros.h"
#include "main/imports.h"
+#include "s_context.h"
#include "s_depth.h"
#include "s_span.h"
}
-/**
- * Return the address of a Z value in a renderbuffer.
- */
-static INLINE void *
-get_z_address(struct gl_renderbuffer *rb, GLint x, GLint y)
-{
- const GLint bpp = _mesa_get_format_bytes(rb->Format);
- const GLint rowStride = rb->RowStride * bpp;
- return (GLubyte *) rb->Data + y * rowStride + x * bpp;
-}
-
-
/**
* Apply depth (Z) buffer testing to the span.
* \return approx number of pixels that passed (only zero is reliable)
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 = get_z_address(rb, span->x, span->y);
+ void *zStart = _swrast_pixel_address(rb, span->x, span->y);
const GLuint count = span->end;
const GLuint *fragZ = span->array->z;
GLubyte *mask = span->array->mask;
return;
}
- _mesa_unpack_float_z_row(rb->Format, n, get_z_address(rb, x, y), depth);
+ _mesa_unpack_float_z_row(rb->Format, n, _swrast_pixel_address(rb, x, y),
+ depth);
}
*/
-/**
- * Return the address of a stencil value in a renderbuffer.
- */
-static inline GLubyte *
-get_stencil_address(struct gl_renderbuffer *rb, GLint x, GLint y)
-{
- const GLint bpp = _mesa_get_format_bytes(rb->Format);
- const GLint rowStride = rb->RowStride * bpp;
- assert(rb->Data);
- return (GLubyte *) rb->Data + y * rowStride + x * bpp;
-}
-
/**
* Compute/return the offset of the stencil value in a pixel.
for (i = 0; i < count; i++) {
if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) {
- GLubyte *dst = get_stencil_address(rb, x[i], y[i]);
+ GLubyte *dst = _swrast_pixel_address(rb, x[i], y[i]);
_mesa_pack_ubyte_stencil_row(rb->Format, 1, &stencil[i], dst);
}
}
* 8 bits for all MESA_FORMATs, we just need to use the right offset
* and stride to access them.
*/
- stencilBuf = get_stencil_address(rb, span->x, span->y) + stencilOffset;
+ stencilBuf = _swrast_pixel_address(rb, span->x, span->y) + stencilOffset;
}
/*
GLint n, GLint x, GLint y, GLubyte stencil[])
{
GLubyte *src;
- const GLuint bpp = _mesa_get_format_bytes(rb->Format);
- const GLuint rowStride = rb->RowStride * bpp;
if (y < 0 || y >= (GLint) rb->Height ||
x + n <= 0 || x >= (GLint) rb->Width) {
return;
}
- src = get_stencil_address(rb, x, y);
+ src = _swrast_pixel_address(rb, x, y);
_mesa_unpack_ubyte_stencil_row(rb->Format, n, src, stencil);
}
return;
}
- stencilBuf = get_stencil_address(rb, x, y);
+ stencilBuf = _swrast_pixel_address(rb, x, y);
if ((stencilMask & stencilMax) != stencilMax) {
/* need to apply writemask */