aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast/s_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/swrast/s_context.h')
-rw-r--r--mesalib/src/mesa/swrast/s_context.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h
index 446b990d9..af9e49ecb 100644
--- a/mesalib/src/mesa/swrast/s_context.h
+++ b/mesalib/src/mesa/swrast/s_context.h
@@ -422,5 +422,17 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx);
#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