Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix missing images when alpha and shader effects are involved
Once we hit removedFromAtlas() and the glCopyTexImage2D() path, bad things
tend to happen with OpenGL ES, both on certain embedded devices (Beaglebone, RPi)
and ANGLE.

ANGLE just rejects GL_BGRA_EXT with INVALID_ENUM. So if it fails, just try
with GL_RGBA. The BGRA extensions do not mention glCopyTexImage2D in any form
and in plain GLES (any version) BGRA does not exist. So rejecting it may be valid,
depending on how one reads the specs.

Same problem on Beaglebone, where the call with BGRA fails as INVALID_OPERATION.

The RPi 1 and 2 fails in a different way: the temporary framebuffer is not complete
because BGRA textures are not supported as color attachments. So our only choice
here is to do what we do for some Android devices already: ignore BGRA support.

Task-number: QTBUG-46806
Change-Id: I89b3b38bf7f8883c39509606ec5ae525f131292b
Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
  • Loading branch information
alpqr authored and sletta committed Sep 8, 2015
1 parent 83898bc commit 9bf675b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/quick/scenegraph/util/qsgatlastexture.cpp
Expand Up @@ -480,7 +480,11 @@ QSGTexture *Texture::removedFromAtlas() const
glBindTexture(GL_TEXTURE_2D, texture);
QRect r = atlasSubRectWithoutPadding();
// and copy atlas into our texture.
while (glGetError() != GL_NO_ERROR) ;
glCopyTexImage2D(GL_TEXTURE_2D, 0, m_atlas->internalFormat(), r.x(), r.y(), r.width(), r.height(), 0);
// BGRA may have been rejected by some GLES implementations
if (glGetError() != GL_NO_ERROR)
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, r.x(), r.y(), r.width(), r.height(), 0);

m_nonatlas_texture = new QSGPlainTexture();
m_nonatlas_texture->setTextureId(texture);
Expand Down

0 comments on commit 9bf675b

Please sign in to comment.