Commit bd1ac7ab authored by Allison Vacanti's avatar Allison Vacanti

Disable glDebugMessageInsert calls by default.

This patch changes this OpenGL debugging feature from a
per-translation-unit #define setting to a CMake option.

This will make it easier to enable/disable, and also prevent compilation
errors on ES platforms.
parent b052d737
......@@ -285,6 +285,14 @@ configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/vtkOpenGLError.h.in
${CMAKE_CURRENT_BINARY_DIR}/vtkOpenGLError.h)
# Add OpenGL command stream annotations via
# vtkOpenGLRenderUtilities::MarkDebugEvent when enabled:
option(VTK_OPENGL_ENABLE_STREAM_ANNOTATIONS
"Enable debugging annotations in the OpenGL command stream."
OFF
)
mark_as_advanced(VTK_OPENGL_ENABLE_STREAM_ANNOTATIONS)
# Configure the module specific settings into a module configured header.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/vtkRenderingOpenGLConfigure.h.in
${CMAKE_CURRENT_BINARY_DIR}/vtkRenderingOpenGLConfigure.h)
......
......@@ -36,10 +36,6 @@
#include <algorithm>
// Define to print debug statements to the OpenGL CS stream (useful for e.g.
// apitrace debugging):
//#define ANNOTATE_STREAM
// Define to output details about each peel:
//#define DEBUG_PEEL
......@@ -75,11 +71,7 @@ namespace
{
void annotate(const std::string &str)
{
#ifdef ANNOTATE_STREAM
vtkOpenGLRenderUtilities::MarkDebugEvent(str);
#else // ANNOTATE_STREAM
(void)str;
#endif // ANNOTATE_STREAM
}
}
......
......@@ -64,18 +64,11 @@ Ph.D. thesis of Christian BOUCHENY.
//#define VTK_EDL_SHADING_DEBUG
// Define to print debug statements to the OpenGL CS stream (useful for e.g.
// apitrace debugging):
// #define ANNOTATE_STREAM
namespace
{
void annotate(const std::string &str)
{
#ifdef ANNOTATE_STREAM
vtkOpenGLRenderUtilities::MarkDebugEvent(str);
#else // ANNOTATE_STREAM
(void)str;
#endif // ANNOTATE_STREAM
}
}
......
......@@ -21,6 +21,7 @@
#include "vtkMapper.h"
#include "vtkObjectFactory.h"
#include "vtkOpenGLError.h"
#include "vtkOpenGLRenderUtilities.h"
#include "vtkProp.h"
#include "vtkProperty.h"
#include "vtkRenderer.h"
......@@ -28,23 +29,11 @@
#include <string>
// Define to print debug statements to the OpenGL CS stream (useful for e.g.
// apitrace debugging):
//#define ANNOTATE_STREAM
namespace
{
void annotate(const std::string &str)
{
#ifdef ANNOTATE_STREAM
vtkOpenGLStaticCheckErrorMacro("Error before glDebug.")
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER,
GL_DEBUG_SEVERITY_NOTIFICATION,
0, str.size(), str.c_str());
vtkOpenGLClearErrorMacro();
#else // ANNOTATE_STREAM
(void)str;
#endif // ANNOTATE_STREAM
vtkOpenGLRenderUtilities::MarkDebugEvent(str);
}
}
......
......@@ -20,6 +20,7 @@
#include "vtkDataObject.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkOpenGLRenderUtilities.h"
#include "vtkOpenGLRenderWindow.h"
#include "vtkOpenGLError.h"
......@@ -35,23 +36,11 @@
#define ID_OFFSET 1
// Define to print debug statements to the OpenGL CS stream (useful for e.g.
// apitrace debugging):
//#define ANNOTATE_STREAM
namespace
{
void annotate(const std::string &str)
{
#ifdef ANNOTATE_STREAM
vtkOpenGLStaticCheckErrorMacro("Error before glDebug.")
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER,
GL_DEBUG_SEVERITY_NOTIFICATION,
0, str.size(), str.c_str());
vtkOpenGLClearErrorMacro();
#else // ANNOTATE_STREAM
(void)str;
#endif // ANNOTATE_STREAM
vtkOpenGLRenderUtilities::MarkDebugEvent(str);
}
}
......
......@@ -19,6 +19,7 @@
#include "vtkOpenGLBufferObject.h"
#include "vtkOpenGLError.h"
#include "vtkOpenGLVertexArrayObject.h"
#include "vtkRenderingOpenGLConfigure.h"
#include "vtkShaderProgram.h"
// ----------------------------------------------------------------------------
......@@ -197,15 +198,13 @@ void vtkOpenGLRenderUtilities::DrawFullScreenQuad()
//------------------------------------------------------------------------------
void vtkOpenGLRenderUtilities::MarkDebugEvent(const std::string &event)
{
static bool hasDebugging = (glDebugMessageInsert != nullptr);
if (!hasDebugging)
{
return;
}
#ifndef VTK_OPENGL_ENABLE_STREAM_ANNOTATIONS
(void)event;
#else // VTK_OPENGL_ENABLE_STREAM_ANNOTATIONS
vtkOpenGLStaticCheckErrorMacro("Error before glDebugMessageInsert.")
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER,
GL_DEBUG_SEVERITY_NOTIFICATION,
0, static_cast<GLsizei>(event.size()), event.c_str());
vtkOpenGLClearErrorMacro();
#endif // VTK_OPENGL_ENABLE_STREAM_ANNOTATIONS
}
......@@ -33,6 +33,7 @@
#cmakedefine VTK_OPENGL_HAS_OSMESA
#cmakedefine VTK_OPENGL_HAS_EGL
#cmakedefine VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN
#cmakedefine VTK_OPENGL_ENABLE_STREAM_ANNOTATIONS
// for legacy codes (don't use these in new codes)
#ifdef VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN
......
......@@ -40,6 +40,7 @@
#include "vtkOpenGLError.h"
#include "vtkOpenGLFramebufferObject.h"
#include "vtkOpenGLIndexBufferObject.h"
#include "vtkOpenGLRenderUtilities.h"
#include "vtkOpenGLRenderWindow.h"
#include "vtkOpenGLShaderCache.h"
#include "vtkOpenGLVertexArrayObject.h"
......@@ -62,21 +63,11 @@
#include "vtkglProjectedTetrahedraVS.h"
#include "vtkglProjectedTetrahedraFS.h"
// Define to print debug statements to the OpenGL CS stream (useful for e.g.
// apitrace debugging):
// #define ANNOTATE_STREAM
namespace
{
void annotate(const std::string& message)
{
#ifdef ANNOTATE_STREAM
vtkOpenGLStaticCheckErrorMacro("Error before glDebug.")
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER,
GL_DEBUG_SEVERITY_NOTIFICATION, 0, message.size(), message.c_str());
vtkOpenGLClearErrorMacro();
#else // ANNOTATE_STREAM
(void)message;
#endif // ANNOTATE_STREAM
vtkOpenGLRenderUtilities::MarkDebugEvent(message);
}
class scoped_annotate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment