aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/fbobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/fbobject.c')
-rw-r--r--mesalib/src/mesa/main/fbobject.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 26ae1087c..f56369483 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -2023,7 +2023,11 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
_glthread_LOCK_MUTEX(fb->Mutex);
if (texObj) {
if (attachment == GL_DEPTH_ATTACHMENT &&
- texObj == fb->Attachment[BUFFER_STENCIL].Texture) {
+ texObj == fb->Attachment[BUFFER_STENCIL].Texture &&
+ level == fb->Attachment[BUFFER_STENCIL].TextureLevel &&
+ _mesa_tex_target_to_face(textarget) ==
+ fb->Attachment[BUFFER_STENCIL].CubeMapFace &&
+ zoffset == fb->Attachment[BUFFER_STENCIL].Zoffset) {
/* The texture object is already attached to the stencil attachment
* point. Don't create a new renderbuffer; just reuse the stencil
* attachment's. This is required to prevent a GL error in
@@ -2032,8 +2036,12 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
reuse_framebuffer_texture_attachment(fb, BUFFER_DEPTH,
BUFFER_STENCIL);
} else if (attachment == GL_STENCIL_ATTACHMENT &&
- texObj == fb->Attachment[BUFFER_DEPTH].Texture) {
- /* As above, but with depth and stencil juxtaposed. */
+ texObj == fb->Attachment[BUFFER_DEPTH].Texture &&
+ level == fb->Attachment[BUFFER_DEPTH].TextureLevel &&
+ _mesa_tex_target_to_face(textarget) ==
+ fb->Attachment[BUFFER_DEPTH].CubeMapFace &&
+ zoffset == fb->Attachment[BUFFER_DEPTH].Zoffset) {
+ /* As above, but with depth and stencil transposed. */
reuse_framebuffer_texture_attachment(fb, BUFFER_STENCIL,
BUFFER_DEPTH);
} else {