[qt, macos] Consume GL_INVALID_OPERATION from Qt
This commit is contained in:
@@ -310,14 +310,5 @@ void MapWindow::paintGL()
|
||||
|
||||
m_map.resize(size(), size() * pixelRatio());
|
||||
|
||||
#if QT_VERSION < 0x050400 && defined(__APPLE__)
|
||||
// XXX GL framebuffer is valid only after first attempt of painting on
|
||||
// older versions of Qt on macOS.
|
||||
// See https://bugreports.qt.io/browse/QTBUG-36802 for details.
|
||||
static bool first = true;
|
||||
if (!first) m_map.render();
|
||||
first = false;
|
||||
#else
|
||||
m_map.render();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "qt_geojson.hpp"
|
||||
|
||||
#include <mbgl/annotation/annotation.hpp>
|
||||
#include <mbgl/gl/gl.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/map/camera.hpp>
|
||||
#include <mbgl/map/map.hpp>
|
||||
@@ -798,13 +799,30 @@ void QMapboxGL::setFilter(const QString& layer_, const QVariant& filter_)
|
||||
#if QT_VERSION >= 0x050000
|
||||
void QMapboxGL::render(QOpenGLFramebufferObject *fbo)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
// FIXME Consume one GL_INVALID_OPERATION from Qt.
|
||||
// See https://bugreports.qt.io/browse/QTBUG-36802 for details.
|
||||
GLenum error = glGetError();
|
||||
if (!(error == GL_NO_ERROR || error == GL_INVALID_OPERATION)) {
|
||||
throw std::runtime_error(std::string("glGetError() returned ") + std::to_string(error));
|
||||
}
|
||||
#endif
|
||||
|
||||
d_ptr->dirty = false;
|
||||
d_ptr->updateFramebufferBinding(fbo);
|
||||
d_ptr->fbo = fbo;
|
||||
d_ptr->mapObj->render(*d_ptr);
|
||||
}
|
||||
#else
|
||||
void QMapboxGL::render()
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
// FIXME Qt 4.x provides an incomplete FBO at start.
|
||||
// See https://bugreports.qt.io/browse/QTBUG-36802 for details.
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
d_ptr->dirty = false;
|
||||
d_ptr->mapObj->render(*d_ptr);
|
||||
}
|
||||
@@ -844,21 +862,6 @@ QMapboxGLPrivate::~QMapboxGLPrivate()
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
void QMapboxGLPrivate::updateFramebufferBinding(QOpenGLFramebufferObject *fbo_)
|
||||
{
|
||||
fbo = fbo_;
|
||||
if (fbo) {
|
||||
getContext().bindFramebuffer.setDirty();
|
||||
getContext().viewport = {
|
||||
0, 0, { static_cast<uint32_t>(fbo->width()), static_cast<uint32_t>(fbo->height()) } };
|
||||
} else {
|
||||
getContext().bindFramebuffer.setCurrentValue(0);
|
||||
assert(mbgl::gl::value::BindFramebuffer::Get() == getContext().bindFramebuffer.getCurrentValue());
|
||||
getContext().viewport = {
|
||||
0, 0, { static_cast<uint32_t>(fbSize.width()), static_cast<uint32_t>(fbSize.height()) } };
|
||||
}
|
||||
}
|
||||
|
||||
void QMapboxGLPrivate::bind() {
|
||||
if (fbo) {
|
||||
fbo->bind();
|
||||
@@ -866,11 +869,6 @@ void QMapboxGLPrivate::bind() {
|
||||
getContext().viewport = {
|
||||
0, 0, { static_cast<uint32_t>(fbo->width()), static_cast<uint32_t>(fbo->height()) }
|
||||
};
|
||||
} else {
|
||||
getContext().bindFramebuffer = 0;
|
||||
getContext().viewport = {
|
||||
0, 0, { static_cast<uint32_t>(fbSize.width()), static_cast<uint32_t>(fbSize.height()) }
|
||||
};
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -31,10 +31,6 @@ public:
|
||||
void invalidate() final;
|
||||
void notifyMapChange(mbgl::MapChange) final;
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
void updateFramebufferBinding(QOpenGLFramebufferObject *);
|
||||
#endif
|
||||
|
||||
mbgl::EdgeInsets margins;
|
||||
QSize size { 0, 0 };
|
||||
QSize fbSize { 0, 0 };
|
||||
|
||||
Reference in New Issue
Block a user