aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_cb_fbo.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-09 17:05:56 +0100
committermarha <marha@users.sourceforge.net>2011-11-09 17:05:56 +0100
commit72d7f8d5af476f12dc75eab4fa9d59364cbec190 (patch)
tree1efac13a52811bfd28ae51538b15f87cbfaf8939 /mesalib/src/mesa/state_tracker/st_cb_fbo.c
parenta3d796bcc7de83fd88b42e09c6a82a8df4f9b836 (diff)
parenta8e5f06fe01732fbd643bc435dd3b8eaa602defe (diff)
downloadvcxsrv-72d7f8d5af476f12dc75eab4fa9d59364cbec190.tar.gz
vcxsrv-72d7f8d5af476f12dc75eab4fa9d59364cbec190.tar.bz2
vcxsrv-72d7f8d5af476f12dc75eab4fa9d59364cbec190.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mapi/glapi/glapi.h
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_fbo.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 6da65d7b9..e04cb4406 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -630,6 +630,62 @@ st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
}
+
+/**
+ * Called via ctx->Driver.MapRenderbuffer.
+ */
+static void
+st_MapRenderbuffer(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint x, GLuint y, GLuint w, GLuint h,
+ GLbitfield mode,
+ GLubyte **mapOut, GLint *rowStrideOut)
+{
+ struct st_context *st = st_context(ctx);
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+ struct pipe_context *pipe = st->pipe;
+ unsigned usage;
+
+ usage = 0x0;
+ if (mode & GL_MAP_READ_BIT)
+ usage |= PIPE_TRANSFER_READ;
+ if (mode & GL_MAP_WRITE_BIT)
+ usage |= PIPE_TRANSFER_WRITE;
+
+ strb->transfer = pipe_get_transfer(pipe,
+ strb->texture,
+ strb->rtt_level,
+ strb->rtt_face + strb->rtt_slice,
+ usage, x, y, w, h);
+ if (strb->transfer) {
+ *mapOut = pipe_transfer_map(pipe, strb->transfer);
+ *rowStrideOut = strb->transfer->stride;
+ }
+ else {
+ *mapOut = NULL;
+ *rowStrideOut = 0;
+ }
+}
+
+
+/**
+ * Called via ctx->Driver.UnmapRenderbuffer.
+ */
+static void
+st_UnmapRenderbuffer(struct gl_context *ctx,
+ struct gl_renderbuffer *rb)
+{
+ struct st_context *st = st_context(ctx);
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+ struct pipe_context *pipe = st->pipe;
+
+ pipe_transfer_unmap(pipe, strb->transfer);
+ pipe->transfer_destroy(pipe, strb->transfer);
+ strb->transfer = NULL;
+}
+
+
+
void st_init_fbo_functions(struct dd_function_table *functions)
{
#if FEATURE_EXT_framebuffer_object
@@ -647,6 +703,9 @@ void st_init_fbo_functions(struct dd_function_table *functions)
functions->DrawBuffers = st_DrawBuffers;
functions->ReadBuffer = st_ReadBuffer;
+
+ functions->MapRenderbuffer = st_MapRenderbuffer;
+ functions->UnmapRenderbuffer = st_UnmapRenderbuffer;
}