summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2016-04-26 02:31:20 -0700
committerKenneth Graunke <kenneth@whitecape.org>2016-04-26 21:32:35 -0700
commit12c43a355c6a8812319dea661480488ed198ed06 (patch)
tree8c4cae4d052769c47a580061f6f6dd740038caaa /src/mesa/main/teximage.c
parent027c6c12220f802b39d0dac1ab996e451f95bcf5 (diff)
downloadexternal_mesa3d-12c43a355c6a8812319dea661480488ed198ed06.zip
external_mesa3d-12c43a355c6a8812319dea661480488ed198ed06.tar.gz
external_mesa3d-12c43a355c6a8812319dea661480488ed198ed06.tar.bz2
mesa: Try to fix CopyTex[Sub]Image of stencil textures.
ES prohibits this, but GL appears to allow it. We at least need this much, or else we'll crash as there's no source to read from. This fixed crashes in the ES tests before I realized I needed to prohibit stencil instead. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 76b6584..6b0744b 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3434,8 +3434,9 @@ get_copy_tex_image_source(struct gl_context *ctx, mesa_format texFormat)
if (_mesa_get_format_bits(texFormat, GL_DEPTH_BITS) > 0) {
/* reading from depth/stencil buffer */
return ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
- }
- else {
+ } else if (_mesa_get_format_bits(texFormat, GL_STENCIL_BITS) > 0) {
+ return ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
+ } else {
/* copying from color buffer */
return ctx->ReadBuffer->_ColorReadBuffer;
}