Fixup GL_RGB10 FBO on OpenGL/ES3

Turns out on OpenGL ES, only the GL_RGB10_A2 form is allowed as a
render buffer storage format.

Change-Id: I42915b61835167ae457aae91da7e75065dd3eb21
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2018-07-18 14:48:05 +02:00
parent ede3791df8
commit e65371caf9

View File

@ -559,11 +559,16 @@ void QOpenGLFramebufferObjectPrivate::initColorBuffer(int idx, GLint *samples)
GLenum storageFormat = color.internalFormat;
// ES requires a sized format. The older desktop extension does not. Correct the format on ES.
if (ctx->isOpenGLES() && color.internalFormat == GL_RGBA) {
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Sized8Formats))
storageFormat = GL_RGBA8;
else
storageFormat = GL_RGBA4;
if (ctx->isOpenGLES()) {
if (color.internalFormat == GL_RGBA) {
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Sized8Formats))
storageFormat = GL_RGBA8;
else
storageFormat = GL_RGBA4;
} else if (color.internalFormat == GL_RGB10) {
// GL_RGB10 is not allowed in ES for glRenderbufferStorage.
storageFormat = GL_RGB10_A2;
}
}
funcs.glGenRenderbuffers(1, &color_buffer);