From: Kenneth Graunke Date: Tue, 26 Apr 2016 09:31:20 +0000 (-0700) Subject: mesa: Try to fix CopyTex[Sub]Image of stencil textures. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=12c43a355c6a8812319dea661480488ed198ed06;p=mesa.git 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 Reviewed-by: Ian Romanick Reviewed-by: Brian Paul Reviewed-by: Chris Forbes --- diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 76b6584d3bf..6b0744beeef 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; }