diff options
author | Brian Paul <[email protected]> | 2011-11-12 11:50:32 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-11-15 07:49:26 -0700 |
commit | 6dbf2bac5043564f32cdad08e8d6220618a02080 (patch) | |
tree | 06c92e2736c9eb55ec48f12b7df2a31aa3bc45bd /src/mesa | |
parent | d0836eda5e7d8e9093c1975ef545e3b3deb287a1 (diff) |
swrast: fix glReadPixels from texture attachment
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=42635
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/swrast/s_texrender.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_texrender.c b/src/mesa/swrast/s_texrender.c index 83e7a6a039e..3734ce6d527 100644 --- a/src/mesa/swrast/s_texrender.c +++ b/src/mesa/swrast/s_texrender.c @@ -567,6 +567,19 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) trb->Base.InternalFormat = trb->TexImage->Base.InternalFormat; trb->Base.Format = trb->TexImage->Base.TexFormat; + /* Set the gl_renderbuffer::Data field so that mapping the buffer + * in renderbuffer.c succeeds. + */ + if (att->Texture->Target == GL_TEXTURE_3D || + att->Texture->Target == GL_TEXTURE_2D_ARRAY_EXT) { + trb->Base.Data = trb->TexImage->Buffer + + trb->TexImage->ImageOffsets[trb->Zoffset] * + _mesa_get_format_bytes(trb->TexImage->Base.TexFormat); + } + else { + trb->Base.Data = trb->TexImage->Buffer; + } + /* XXX may need more special cases here */ switch (trb->TexImage->Base.TexFormat) { case MESA_FORMAT_Z24_S8: |