summaryrefslogtreecommitdiffstats
path: root/src/opengl/qopenglframebufferobject.cpp
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2024-02-07 11:28:27 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-02-09 14:26:33 +0000
commit6ae9a8441e35ff36a7a0d53e7d0dfc2de094854d (patch)
treee0cdca4d47a5cb7358419f2de7e837ed89d2e2dd /src/opengl/qopenglframebufferobject.cpp
parent15c45090183e48368f6db5a1d1bd75036f0d8c35 (diff)
Refix invalid glTexImage2D operation in FramebufferObject
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 ba9e57d65f15c935632b0ad22db0bead9a7d5f90. Pick-to: 6.6 6.5 Change-Id: I9a004331513179a3f840a007af0418d14e7f5dff Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit b0056f052d842150305d59a3ced280e1885a8619) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/opengl/qopenglframebufferobject.cpp')
-rw-r--r--src/opengl/qopenglframebufferobject.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/opengl/qopenglframebufferobject.cpp b/src/opengl/qopenglframebufferobject.cpp
index 75dc8d901e7..5c8f769d399 100644
--- a/src/opengl/qopenglframebufferobject.cpp
+++ b/src/opengl/qopenglframebufferobject.cpp
@@ -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;