diff options
author | marha <marha@users.sourceforge.net> | 2012-01-25 08:32:49 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-01-25 08:32:49 +0100 |
commit | 0c1cee47049afdcf74d87a23f4f4fd57867f6798 (patch) | |
tree | 14c117114d1b996e5b04e6546b1580ea53bc26f2 /mesalib/src/mesa/swrast/s_context.h | |
parent | 5be921907008288d6465962063bc10fd7a5b1906 (diff) | |
parent | e6432710d8a586386b3c7025e845cf4f80830da3 (diff) | |
download | vcxsrv-0c1cee47049afdcf74d87a23f4f4fd57867f6798.tar.gz vcxsrv-0c1cee47049afdcf74d87a23f4f4fd57867f6798.tar.bz2 vcxsrv-0c1cee47049afdcf74d87a23f4f4fd57867f6798.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/swrast/s_context.h')
-rw-r--r-- | mesalib/src/mesa/swrast/s_context.h | 47 |
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; } |