aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast/s_context.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-25 08:24:51 +0100
committermarha <marha@users.sourceforge.net>2012-01-25 08:24:51 +0100
commite6432710d8a586386b3c7025e845cf4f80830da3 (patch)
treea403fa86779a287c97f5605f9b4d455d662ece66 /mesalib/src/mesa/swrast/s_context.h
parentd3f0fe49b8cb29295f3e529cc699a2abde1515a1 (diff)
downloadvcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.tar.gz
vcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.tar.bz2
vcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.zip
mesa git update 25 jan 2012
Diffstat (limited to 'mesalib/src/mesa/swrast/s_context.h')
-rw-r--r--mesalib/src/mesa/swrast/s_context.h47
1 files changed, 38 insertions, 9 deletions
diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h
index 0a383aa3b..ae239a9a8 100644
--- a/mesalib/src/mesa/swrast/s_context.h
+++ b/mesalib/src/mesa/swrast/s_context.h
@@ -120,14 +120,10 @@ typedef void (*FetchTexelFunc)(const struct swrast_texture_image *texImage,
GLfloat *texelOut);
-typedef void (*StoreTexelFunc)(struct swrast_texture_image *texImage,
- GLint col, GLint row, GLint img,
- const void *texel);
-
/**
* Subclass of gl_texture_image.
* We need extra fields/info to keep tracking of mapped texture buffers,
- * strides and Fetch/Store functions.
+ * strides and Fetch functions.
*/
struct swrast_texture_image
{
@@ -142,13 +138,12 @@ struct swrast_texture_image
GLint RowStride; /**< Padded width in units of texels */
GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to
each 2D slice in 'Data', in texels */
- GLubyte *Data; /**< Image data, accessed via FetchTexel() */
+ GLubyte *Map; /**< Pointer to mapped image memory */
/** Malloc'd texture memory */
GLubyte *Buffer;
FetchTexelFunc FetchTexel;
- StoreTexelFunc Store;
};
@@ -168,6 +163,31 @@ swrast_texture_image_const(const struct gl_texture_image *img)
/**
+ * Subclass of gl_renderbuffer with extra fields needed for software
+ * rendering.
+ */
+struct swrast_renderbuffer
+{
+ struct gl_renderbuffer Base;
+
+ GLubyte *Buffer; /**< The malloc'd memory for buffer */
+
+ /** These fields are only valid while buffer is mapped for rendering */
+ GLubyte *Map;
+ GLint RowStride; /**< in bytes */
+};
+
+
+/** cast wrapper */
+static inline struct swrast_renderbuffer *
+swrast_renderbuffer(struct gl_renderbuffer *img)
+{
+ return (struct swrast_renderbuffer *) img;
+}
+
+
+
+/**
* \struct SWcontext
* \brief Per-context state that's private to the software rasterizer module.
*/
@@ -428,9 +448,18 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx);
static inline GLubyte *
_swrast_pixel_address(struct gl_renderbuffer *rb, GLint x, GLint y)
{
+ struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
const GLint bpp = _mesa_get_format_bytes(rb->Format);
- const GLint rowStride = rb->RowStride * bpp;
- return (GLubyte *) rb->Data + y * rowStride + x * bpp;
+ const GLint rowStride = srb->RowStride;
+ assert(x >= 0);
+ assert(y >= 0);
+ /* NOTE: using <= only because of s_tritemp.h which gets a pixel
+ * address but doesn't necessarily access it.
+ */
+ assert(x <= (GLint) rb->Width);
+ assert(y <= (GLint) rb->Height);
+ assert(srb->Map);
+ return (GLubyte *) srb->Map + y * rowStride + x * bpp;
}