Mesa (8.0): intel: fix mapping of malloc'd renderbuffers
Brian Paul
brianp at kemper.freedesktop.org
Fri Jan 13 17:27:13 UTC 2012
Module: Mesa
Branch: 8.0
Commit: cd56917a50ee8f2fe56ae0f12b1769351b21425c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd56917a50ee8f2fe56ae0f12b1769351b21425c
Author: Brian Paul <brianp at vmware.com>
Date: Sat Jan 7 15:05:35 2012 -0700
intel: fix mapping of malloc'd renderbuffers
This fixes accum buffer operations. The accumulation buffer is the
only malloc-based renderbuffer for the intel drivers.
v2: apply x/y offset to returned pointer
NOTE: This is a candidate for the 8.0 branch.
Reviewed-by: Eric Anholt <eric at anholt.net>
(cherry picked from commit 6dbdc0395698de929e23b4ec1ab399e64ecfd264)
---
src/mesa/drivers/dri/intel/intel_fbo.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index b95193d..1d8b10e 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -132,6 +132,15 @@ intel_map_renderbuffer(struct gl_context *ctx,
void *map;
int stride;
+ if (!irb && rb->Data) {
+ /* this is a malloc'd renderbuffer (accum buffer) */
+ GLint bpp = _mesa_get_format_bytes(rb->Format);
+ GLint rowStride = rb->RowStride * bpp;
+ *out_map = (GLubyte *) rb->Data + y * rowStride + x * bpp;
+ *out_stride = rowStride;
+ return;
+ }
+
/* We sometimes get called with this by our intel_span.c usage. */
if (!irb->mt) {
*out_map = NULL;
@@ -176,6 +185,12 @@ intel_unmap_renderbuffer(struct gl_context *ctx,
DBG("%s: rb %d (%s)\n", __FUNCTION__,
rb->Name, _mesa_get_format_name(rb->Format));
+ if (!irb && rb->Data) {
+ /* this is a malloc'd renderbuffer (accum buffer) */
+ /* nothing to do */
+ return;
+ }
+
intel_miptree_unmap(intel, irb->mt, irb->mt_level, irb->mt_layer);
}
More information about the mesa-commit
mailing list