summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-02-10 18:40:02 -0700
committerBrian Paul <[email protected]>2012-02-15 14:07:43 -0700
commit2e12b4cfef79b81a68597ec1320754989b1c1fa4 (patch)
treefae794de8d00e101ddf5319f4faba04462cb97a4
parentd765c8ee8c761bb73d634bb274cfc5061892c9a8 (diff)
st/mesa: remove st_renderbuffer::stride
It was only used for software buffers and easily computed. Reviewed-by: Jose Fonseca <[email protected]>
-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 */