Fix renderbufferStorageMultisample: invalid internalformat

Chrome 78 is outputting "INVALID_ENUM: renderbufferStorageMultisample: invalid
internalformat" when running a Qt application after building it for WebAssembly (WASM)
against the Qt 5.13 branch using the Emscripten 1.39.3 (upstream) compiler.

The problem appear to be caused by glRenderbufferStorageMultisample not supporting
GL_DEPTH_STENCIL directly. Instead, GL_DEPTH24_STENCIL8 or GL_DEPTH32F_STENCIL8
should be passed. Keeping the glRenderbufferStorage call as-is.

Change-Id: I777dbc26b1d989950525a434a25ed344389f5059
Reference: https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glRenderbufferStorageMultisample.xhtml
Fixes: QTBUG-80286
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Fredrik Orderud 2019-11-24 21:45:46 +01:00
parent d5608ca437
commit 8a60244da8

View File

@ -658,13 +658,11 @@ void QOpenGLFramebufferObjectPrivate::initDepthStencilAttachments(QOpenGLContext
funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer);
Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer));
GLenum storageFormat = GL_DEPTH_STENCIL;
if (samples != 0 ) {
funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
storageFormat, dsSize.width(), dsSize.height());
GL_DEPTH24_STENCIL8, dsSize.width(), dsSize.height());
} else {
funcs.glRenderbufferStorage(GL_RENDERBUFFER, storageFormat,
funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_STENCIL,
dsSize.width(), dsSize.height());
}