Skip to content

Commit

Permalink
Refix invalid glTexImage2D operation in FramebufferObject
Browse files Browse the repository at this point in the history
A recent change fixed the texture format parameter to be RGB instead
of RGBA for opaque internal formats. However, this broke the RGB10
case, since the pixel type is then GL_UNSIGNED_INT_2_10_10_10_REV. The
doc says:

"GL_INVALID_OPERATION is generated if type is [...]
GL_UNSIGNED_INT_2_10_10_10_REV [...] and format is neither GL_RGBA nor
GL_BGRA."
https://registry.khronos.org/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml

This modifies ba9e57d.

Pick-to: 6.7 6.6 6.5
Change-Id: I9a004331513179a3f840a007af0418d14e7f5dff
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
  • Loading branch information
aavit committed Feb 9, 2024
1 parent a8da982 commit b0056f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/opengl/qopenglframebufferobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,12 +553,14 @@ void QOpenGLFramebufferObjectPrivate::initTexture(int idx)
bool isOpaque = false;
switch (color.internalFormat) {
case GL_RGB8:
case GL_RGB10:
case GL_RGB16:
case GL_RGB16F:
case GL_RGB32F:
isOpaque = true;
break;
case GL_RGB10:
// opaque but the pixel type (INT_2_10_10_10) has alpha and so requires RGBA texture format
break;
}
const GLuint textureFormat = isOpaque ? GL_RGB : GL_RGBA;

Expand Down

0 comments on commit b0056f0

Please sign in to comment.