mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 19:10:49 +02:00
Only enable debug GL context on demand
This commit is contained in:
parent
405ec228b8
commit
9a30073f27
3 changed files with 10 additions and 21 deletions
|
@ -31,6 +31,10 @@ using namespace gl;
|
||||||
|
|
||||||
|
|
||||||
bool Context::enableDebugLogger() {
|
bool Context::enableDebugLogger() {
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
|
// OSX does not support GL_KHR_debug or GL_ARB_debug_output
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
#if defined(DEBUG) || defined(USE_GLES)
|
#if defined(DEBUG) || defined(USE_GLES)
|
||||||
static bool enableDebugLogger = true;
|
static bool enableDebugLogger = true;
|
||||||
#else
|
#else
|
||||||
|
@ -45,6 +49,7 @@ bool Context::enableDebugLogger() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return enableDebugLogger;
|
return enableDebugLogger;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -233,7 +238,6 @@ GLAPI PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
|
||||||
|
|
||||||
Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
|
Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
|
||||||
|
|
||||||
|
|
||||||
void Context::create(QOpenGLContext* shareContext) {
|
void Context::create(QOpenGLContext* shareContext) {
|
||||||
assert(0 != _hwnd);
|
assert(0 != _hwnd);
|
||||||
assert(0 == _hdc);
|
assert(0 == _hdc);
|
||||||
|
@ -351,7 +355,6 @@ void Context::create(QOpenGLContext* shareContext) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
OffscreenContext::~OffscreenContext() {
|
OffscreenContext::~OffscreenContext() {
|
||||||
_window->deleteLater();
|
_window->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include <QtGui/QOpenGLContext>
|
#include <QtGui/QOpenGLContext>
|
||||||
#include <QtGui/QOpenGLDebugLogger>
|
#include <QtGui/QOpenGLDebugLogger>
|
||||||
|
|
||||||
|
#include "Context.h"
|
||||||
|
|
||||||
size_t evalGLFormatSwapchainPixelSize(const QSurfaceFormat& format) {
|
size_t evalGLFormatSwapchainPixelSize(const QSurfaceFormat& format) {
|
||||||
size_t pixelSize = format.redBufferSize() + format.greenBufferSize() + format.blueBufferSize() + format.alphaBufferSize();
|
size_t pixelSize = format.redBufferSize() + format.greenBufferSize() + format.blueBufferSize() + format.alphaBufferSize();
|
||||||
// We don't apply the length of the swap chain into this pixelSize since it is not vsible for the Process (on windows).
|
// We don't apply the length of the swap chain into this pixelSize since it is not vsible for the Process (on windows).
|
||||||
|
@ -97,7 +99,9 @@ const QSurfaceFormat& getDefaultOpenGLSurfaceFormat() {
|
||||||
#else
|
#else
|
||||||
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
||||||
#endif
|
#endif
|
||||||
format.setOption(QSurfaceFormat::DebugContext);
|
if (gl::Context::enableDebugLogger()) {
|
||||||
|
format.setOption(QSurfaceFormat::DebugContext);
|
||||||
|
}
|
||||||
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
||||||
format.setDepthBufferSize(DEFAULT_GL_DEPTH_BUFFER_BITS);
|
format.setDepthBufferSize(DEFAULT_GL_DEPTH_BUFFER_BITS);
|
||||||
format.setStencilBufferSize(DEFAULT_GL_STENCIL_BUFFER_BITS);
|
format.setStencilBufferSize(DEFAULT_GL_STENCIL_BUFFER_BITS);
|
||||||
|
|
|
@ -7,24 +7,6 @@
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
using TextureAndFence = hifi::qml::OffscreenSurface::TextureAndFence;
|
using TextureAndFence = hifi::qml::OffscreenSurface::TextureAndFence;
|
||||||
//
|
|
||||||
//void MacQml::destroySurface(QmlInfo& qmlInfo) {
|
|
||||||
// auto& surface = qmlInfo.surface;
|
|
||||||
// auto& currentTexture = qmlInfo.texture;
|
|
||||||
// if (currentTexture) {
|
|
||||||
// auto readFence = _glf.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
||||||
// glFlush();
|
|
||||||
// _discardLamdba(currentTexture, readFence);
|
|
||||||
// }
|
|
||||||
// auto webView = surface->getRootItem();
|
|
||||||
// if (webView) {
|
|
||||||
// // stop loading
|
|
||||||
// QMetaObject::invokeMethod(webView, "stop");
|
|
||||||
// webView->setProperty(URL_PROPERTY, "about:blank");
|
|
||||||
// }
|
|
||||||
// surface->pause();
|
|
||||||
// surface.reset();
|
|
||||||
//}
|
|
||||||
|
|
||||||
void MacQml::update() {
|
void MacQml::update() {
|
||||||
auto rootItem =_surface->getRootItem();
|
auto rootItem =_surface->getRootItem();
|
||||||
|
|
Loading…
Reference in a new issue