mesa/fbobject: Update CubeMapFace when reusing textures
authorNanley Chery <nanley.g.chery@intel.com>
Wed, 16 Nov 2016 00:42:23 +0000 (16:42 -0800)
committerNanley Chery <nanley.g.chery@intel.com>
Fri, 18 Nov 2016 19:58:19 +0000 (11:58 -0800)
commit63318d34acd4a5edb271d57adf3b01e2e52552f8
tree611e9532836003bdf617420eae4a66794c28be35
parent9a806d2d15d9ec9e11087e4bd7dd390e4263309c
mesa/fbobject: Update CubeMapFace when reusing textures

Framebuffer attachments can be specified through FramebufferTexture*
calls. Upon specifying a depth (or stencil) framebuffer attachment that
internally reuses a texture, the cube map face of the new attachment
would not be updated (defaulting to TEXTURE_CUBE_MAP_POSITIVE_X).
Fix this issue by actually updating the CubeMapFace field.

This bug manifested itself in BindFramebuffer calls performed on
framebuffers whose stencil attachments internally reused a depth
texture.  When binding a framebuffer, we walk through the framebuffer's
attachments and update each one's corresponding gl_renderbuffer. Since
the framebuffer's depth and stencil attachments may share a
gl_renderbuffer and the walk visits the stencil attachment after
the depth attachment, the uninitialized CubeMapFace forced rendering
to TEXTURE_CUBE_MAP_POSITIVE_X.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77662
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/fbobject.c