summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-10-13 12:02:43 -0700
committerEric Anholt <[email protected]>2011-11-01 15:42:17 -0700
commit76d1275474d7b5ac2f0edf5856ae1c5fc234f0d9 (patch)
tree237e9241c2cd2c749b3fcb979c2e4a15bb35da00 /src/mesa/main
parenta25a452fbed6cd72b356ff96839d2097b3e4a4fe (diff)
Add MapRenderbuffer implementations for software drivers.
Mesa core's is generic for things like osmesa. For swrast_dri.so, we have to do Y flipping. The front-buffer path isn't actually tested, though, because both before and after it fails with a BadMatch in XGetImage. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/renderbuffer.c27
-rw-r--r--src/mesa/main/renderbuffer.h12
2 files changed, 39 insertions, 0 deletions
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 70011e6b24a..5dd46cc9ad0 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -1716,6 +1716,33 @@ _mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *
}
+void
+_mesa_map_soft_renderbuffer(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint x, GLuint y, GLuint w, GLuint h,
+ GLbitfield mode,
+ GLubyte **out_map,
+ GLint *out_stride)
+{
+ GLubyte *map = rb->Data;
+ int cpp = _mesa_get_format_bytes(rb->Format);
+ int stride = rb->RowStride * cpp;
+
+ ASSERT(rb->Data);
+
+ map += y * stride;
+ map += x * cpp;
+
+ *out_map = map;
+ *out_stride = stride;
+}
+
+void
+_mesa_unmap_soft_renderbuffer(struct gl_context *ctx,
+ struct gl_renderbuffer *rb)
+{
+}
+
/**********************************************************************/
/**********************************************************************/
diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h
index de471cd6b22..cb0d712ebe6 100644
--- a/src/mesa/main/renderbuffer.h
+++ b/src/mesa/main/renderbuffer.h
@@ -46,6 +46,18 @@ _mesa_delete_renderbuffer(struct gl_renderbuffer *rb);
extern struct gl_renderbuffer *
_mesa_new_soft_renderbuffer(struct gl_context *ctx, GLuint name);
+void
+_mesa_map_soft_renderbuffer(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint x, GLuint y, GLuint w, GLuint h,
+ GLbitfield mode,
+ GLubyte **out_map,
+ GLint *out_stride);
+
+void
+_mesa_unmap_soft_renderbuffer(struct gl_context *ctx,
+ struct gl_renderbuffer *rb);
+
extern void
_mesa_set_renderbuffer_accessors(struct gl_renderbuffer *rb);