Pass a sized format when creating multisampled renderbuffers on ES
Task-number: QTBUG-40921 Change-Id: I96b05442dd5928992dab06553b3d41feca89084d Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
parent
54814bbd8f
commit
1a801e0eef
@ -80,7 +80,8 @@ public:
|
||||
SRGBFrameBuffer = 0x00020000,
|
||||
MapBuffer = 0x00040000,
|
||||
GeometryShaders = 0x00080000,
|
||||
MapBufferRange = 0x00100000
|
||||
MapBufferRange = 0x00100000,
|
||||
Sized8Formats = 0x00200000
|
||||
};
|
||||
Q_DECLARE_FLAGS(OpenGLExtensions, OpenGLExtension)
|
||||
|
||||
|
@ -452,13 +452,7 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi
|
||||
if (!funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
|
||||
|| !funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit)) {
|
||||
samples = 0;
|
||||
}
|
||||
|
||||
// On GLES 2.0 multisampled framebuffers are available through vendor-specific extensions
|
||||
const bool msaaES2 = ctx->isOpenGLES() && (ctx->hasExtension("GL_ANGLE_framebuffer_multisample")
|
||||
|| ctx->hasExtension("GL_NV_framebuffer_multisample"));
|
||||
|
||||
if (!ctx->isOpenGLES() || msaaES2) {
|
||||
} else if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
|
||||
GLint maxSamples;
|
||||
funcs.glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
|
||||
samples = qBound(0, int(samples), int(maxSamples));
|
||||
@ -483,11 +477,15 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi
|
||||
initTexture(texture_target, internal_format, size, mipmap);
|
||||
} else {
|
||||
GLenum storageFormat = internal_format;
|
||||
// ES requires a sized format. The older desktop extension does not. Correct the format on ES.
|
||||
if (ctx->isOpenGLES() && internal_format == GL_RGBA) {
|
||||
#ifdef GL_RGBA8_OES
|
||||
// Correct the internal format used by the render buffer when using ES with extensions
|
||||
if (msaaES2 && internal_format == GL_RGBA)
|
||||
storageFormat = GL_RGBA8_OES;
|
||||
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Sized8Formats))
|
||||
storageFormat = GL_RGBA8_OES;
|
||||
else
|
||||
#endif
|
||||
storageFormat = GL_RGBA4;
|
||||
}
|
||||
|
||||
mipmap = false;
|
||||
funcs.glGenRenderbuffers(1, &color_buffer);
|
||||
|
@ -385,7 +385,8 @@ static int qt_gl_resolve_extensions()
|
||||
| QOpenGLExtensions::ElementIndexUint
|
||||
| QOpenGLExtensions::MapBufferRange
|
||||
| QOpenGLExtensions::FramebufferBlit
|
||||
| QOpenGLExtensions::FramebufferMultisample;
|
||||
| QOpenGLExtensions::FramebufferMultisample
|
||||
| QOpenGLExtensions::Sized8Formats;
|
||||
} else {
|
||||
// Recognize features by extension name.
|
||||
if (extensionMatcher.match("GL_OES_packed_depth_stencil"))
|
||||
@ -400,6 +401,8 @@ static int qt_gl_resolve_extensions()
|
||||
extensions |= QOpenGLExtensions::FramebufferBlit;
|
||||
if (extensionMatcher.match("GL_NV_framebuffer_multisample"))
|
||||
extensions |= QOpenGLExtensions::FramebufferMultisample;
|
||||
if (extensionMatcher.match("GL_OES_rgb8_rgba8"))
|
||||
extensions |= QOpenGLExtensions::Sized8Formats;
|
||||
}
|
||||
|
||||
if (extensionMatcher.match("GL_OES_mapbuffer"))
|
||||
@ -419,9 +422,10 @@ static int qt_gl_resolve_extensions()
|
||||
extensions |= QOpenGLExtensions::GenerateMipmap;
|
||||
|
||||
if (format.majorVersion() >= 3 || extensionMatcher.match("GL_ARB_framebuffer_object")) {
|
||||
extensions |= QOpenGLExtensions::FramebufferMultisample |
|
||||
QOpenGLExtensions::FramebufferBlit |
|
||||
QOpenGLExtensions::PackedDepthStencil;
|
||||
extensions |= QOpenGLExtensions::FramebufferMultisample
|
||||
| QOpenGLExtensions::FramebufferBlit
|
||||
| QOpenGLExtensions::PackedDepthStencil
|
||||
| QOpenGLExtensions::Sized8Formats;
|
||||
} else {
|
||||
// Recognize features by extension name.
|
||||
if (extensionMatcher.match("GL_EXT_framebuffer_multisample"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user