Mesa (renderbuffer-cleanups-v2): swrast: use Map/UnmapTextureImage() in framebuffer map/unmap code
Brian Paul
brianp at kemper.freedesktop.org
Thu Jan 19 00:39:47 UTC 2012
Module: Mesa
Branch: renderbuffer-cleanups-v2
Commit: 3e8a8b5443a376050620200f211be0fe67fc61ff
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e8a8b5443a376050620200f211be0fe67fc61ff
Author: Brian Paul <brianp at vmware.com>
Date: Wed Jan 18 17:39:33 2012 -0700
swrast: use Map/UnmapTextureImage() in framebuffer map/unmap code
When we're actually rendering into a texture, map the texture image
instead of the corresponding renderbuffer. Before, we just copied
a pointer from the texture image to the renderbuffer. This change
will make the code usable by hardware drivers.
---
src/mesa/swrast/s_renderbuffer.c | 28 +++++++++++++---------------
1 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
index 501b469..637a7b6 100644
--- a/src/mesa/swrast/s_renderbuffer.c
+++ b/src/mesa/swrast/s_renderbuffer.c
@@ -565,20 +565,16 @@ map_attachment(struct gl_context *ctx,
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
if (texObj) {
+ /* map texture image (render to texture) */
const GLuint level = fb->Attachment[buffer].TextureLevel;
const GLuint face = fb->Attachment[buffer].CubeMapFace;
+ const GLuint slice = fb->Attachment[buffer].Zoffset;
struct gl_texture_image *texImage = texObj->Image[face][level];
if (texImage) {
- struct swrast_texture_image *swImage
- = swrast_texture_image(texImage);
-
- /* XXX we'll eventually call _swrast_map_teximage() here */
- swImage->Map = swImage->Buffer;
- if (srb) {
- srb->Map = swImage->Buffer;
- srb->RowStride = swImage->RowStride *
- _mesa_get_format_bytes(swImage->Base.TexFormat);
- }
+ ctx->Driver.MapTextureImage(ctx, texImage, slice,
+ 0, 0, texImage->Width, texImage->Height,
+ GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
+ &srb->Map, &srb->RowStride);
}
}
else if (rb) {
@@ -587,8 +583,9 @@ map_attachment(struct gl_context *ctx,
0, 0, rb->Width, rb->Height,
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
&srb->Map, &srb->RowStride);
- assert(srb->Map);
}
+
+ assert(srb->Map);
}
@@ -602,14 +599,15 @@ unmap_attachment(struct gl_context *ctx,
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
if (texObj) {
+ /* unmap texture image (render to texture) */
const GLuint level = fb->Attachment[buffer].TextureLevel;
const GLuint face = fb->Attachment[buffer].CubeMapFace;
+ const GLuint slice = fb->Attachment[buffer].Zoffset;
struct gl_texture_image *texImage = texObj->Image[face][level];
if (texImage) {
-
- /* XXX we'll eventually call _swrast_unmap_teximage() here */
- }
- }
+ ctx->Driver.UnmapTextureImage(ctx, texImage, slice);
+ }
+ }
else if (rb) {
/* unmap ordinary renderbuffer */
ctx->Driver.UnmapRenderbuffer(ctx, rb);
More information about the mesa-commit
mailing list