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@anholt.net>
This commit is contained in:
@@ -132,6 +132,15 @@ intel_map_renderbuffer(struct gl_context *ctx,
|
|||||||
void *map;
|
void *map;
|
||||||
int stride;
|
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. */
|
/* We sometimes get called with this by our intel_span.c usage. */
|
||||||
if (!irb->mt) {
|
if (!irb->mt) {
|
||||||
*out_map = NULL;
|
*out_map = NULL;
|
||||||
@@ -176,6 +185,12 @@ intel_unmap_renderbuffer(struct gl_context *ctx,
|
|||||||
DBG("%s: rb %d (%s)\n", __FUNCTION__,
|
DBG("%s: rb %d (%s)\n", __FUNCTION__,
|
||||||
rb->Name, _mesa_get_format_name(rb->Format));
|
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);
|
intel_miptree_unmap(intel, irb->mt, irb->mt_level, irb->mt_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user