/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
constchar* getSeverityString(GLenum severity)
{ switch(severity)
{ case GL_DEBUG_SEVERITY_LOW: return"low"; case GL_DEBUG_SEVERITY_MEDIUM: return"medium"; case GL_DEBUG_SEVERITY_HIGH: return"high"; default:
;
}
return"unknown";
}
constchar* getSourceString(GLenum source)
{ switch(source)
{ case GL_DEBUG_SOURCE_API: return"API"; case GL_DEBUG_SOURCE_SHADER_COMPILER: return"shader compiler"; case GL_DEBUG_SOURCE_WINDOW_SYSTEM: return"window system"; case GL_DEBUG_SOURCE_THIRD_PARTY: return"third party"; case GL_DEBUG_SOURCE_APPLICATION: return"Libreoffice"; case GL_DEBUG_SOURCE_OTHER: return"unknown"; default:
;
}
return"unknown";
}
constchar* getTypeString(GLenum type)
{ switch(type)
{ case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return"deprecated behavior"; case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return"undefined behavior"; case GL_DEBUG_TYPE_PERFORMANCE: return"performance"; case GL_DEBUG_TYPE_PORTABILITY: return"portability"; case GL_DEBUG_TYPE_MARKER: return"marker"; case GL_DEBUG_TYPE_PUSH_GROUP: return"push group"; case GL_DEBUG_TYPE_POP_GROUP: return"pop group"; case GL_DEBUG_TYPE_OTHER: return"other"; case GL_DEBUG_TYPE_ERROR: return"error"; default:
;
}
return"unknown";
}
extern"C"void #ifdefined _WIN32
APIENTRY #endif
debug_callback(GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei , const GLchar* message, const GLvoid*)
{ // ignore Nvidia's 131218: "Program/shader state performance warning: Fragment Shader is going to be recompiled because the shader key based on GL state mismatches." // the GLSL compiler is a bit too aggressive in optimizing the state based on the current OpenGL state
// ignore 131185: "Buffer detailed info: Buffer object x (bound to GL_ARRAY_BUFFER_ARB, // usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations." if (id == 131218 || id == 131185) return;
// I think we need at least GL 3.0 if (epoxy_gl_version() < 30)
{
SAL_WARN("vcl.opengl", "We don't have at least OpenGL 3.0"); returnfalse;
}
// Check that some "optional" APIs that we use unconditionally are present if (!glBindFramebuffer)
{
SAL_WARN("vcl.opengl", "We don't have glBindFramebuffer"); returnfalse;
}
returntrue;
}
void OpenGLContext::InitGLDebugging()
{ #ifdef DBG_UTIL // only enable debug output in dbgutil build if (epoxy_has_gl_extension("GL_ARB_debug_output"))
{
OpenGLZone aZone;
if (glDebugMessageCallbackARB)
{
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
glDebugMessageCallbackARB(&debug_callback, nullptr);
// release all framebuffers from the old context so we can re-attach the // texture in the new context
rtl::Reference<OpenGLContext> pCurrentCtx = pSVData->maGDIData.mpLastContext;
if ( !pCurrentCtx.is() ) return; // Not using OpenGL
SAL_INFO("vcl.opengl", "Unbinding contexts in preparation for yield");
// Find the first context that is current and reset it. // Usually the last context is the current, but not in case a new // OpenGLContext is created already but not yet initialized. while (pCurrentCtx.is())
{ if (pCurrentCtx->isCurrent())
{
pCurrentCtx->resetCurrent(); break;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.