summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c13
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.h1
2 files changed, 6 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 85086bbd2a9..2e884a42619 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -105,8 +105,7 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
free(strb->data);
- strb->stride = util_format_get_stride(format, width);
- size = util_format_get_2d_size(format, strb->stride, height);
+ size = _mesa_format_image_size(strb->Base.Format, width, height, 1);
strb->data = malloc(size);
@@ -640,12 +639,12 @@ st_MapRenderbuffer(struct gl_context *ctx,
if (strb->software) {
/* software-allocated renderbuffer (probably an accum buffer) */
- GLubyte *map = (GLubyte *) strb->data;
if (strb->data) {
- map += strb->stride * y;
- map += _mesa_get_format_bytes(strb->Base.Format) * x;
- *mapOut = map;
- *rowStrideOut = strb->stride;
+ GLint bpp = _mesa_get_format_bytes(strb->Base.Format);
+ GLint stride = _mesa_format_row_stride(strb->Base.Format,
+ strb->Base.Width);
+ *mapOut = (GLubyte *) strb->data + y * stride + x * bpp;
+ *rowStrideOut = stride;
}
else {
*mapOut = NULL;
diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h
index 7a2d4d8b157..506fd06d680 100644
--- a/src/mesa/state_tracker/st_cb_fbo.h
+++ b/src/mesa/state_tracker/st_cb_fbo.h
@@ -56,7 +56,6 @@ struct st_renderbuffer
* Used only when hardware accumulation buffers are not supported.
*/
boolean software;
- size_t stride;
void *data;
struct st_texture_object *rtt; /**< GL render to texture's texture */