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( ...@@ -285,6 +285,14 @@ configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/vtkOpenGLError.h.in ${CMAKE_CURRENT_SOURCE_DIR}/vtkOpenGLError.h.in
${CMAKE_CURRENT_BINARY_DIR}/vtkOpenGLError.h) ${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 the module specific settings into a module configured header.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/vtkRenderingOpenGLConfigure.h.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/vtkRenderingOpenGLConfigure.h.in
${CMAKE_CURRENT_BINARY_DIR}/vtkRenderingOpenGLConfigure.h) ${CMAKE_CURRENT_BINARY_DIR}/vtkRenderingOpenGLConfigure.h)
......
...@@ -36,10 +36,6 @@ ...@@ -36,10 +36,6 @@
#include <algorithm> #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 to output details about each peel:
//#define DEBUG_PEEL //#define DEBUG_PEEL
...@@ -75,11 +71,7 @@ namespace ...@@ -75,11 +71,7 @@ namespace
{ {
void annotate(const std::string &str) void annotate(const std::string &str)
{ {
#ifdef ANNOTATE_STREAM
vtkOpenGLRenderUtilities::MarkDebugEvent(str); vtkOpenGLRenderUtilities::MarkDebugEvent(str);
#else // ANNOTATE_STREAM
(void)str;
#endif // ANNOTATE_STREAM
} }
} }
......
...@@ -64,18 +64,11 @@ Ph.D. thesis of Christian BOUCHENY. ...@@ -64,18 +64,11 @@ Ph.D. thesis of Christian BOUCHENY.
//#define VTK_EDL_SHADING_DEBUG //#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 namespace
{ {
void annotate(const std::string &str) void annotate(const std::string &str)
{ {
#ifdef ANNOTATE_STREAM
vtkOpenGLRenderUtilities::MarkDebugEvent(str); vtkOpenGLRenderUtilities::MarkDebugEvent(str);
#else // ANNOTATE_STREAM
(void)str;
#endif // ANNOTATE_STREAM
} }
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "vtkMapper.h" #include "vtkMapper.h"
#include "vtkObjectFactory.h" #include "vtkObjectFactory.h"
#include "vtkOpenGLError.h" #include "vtkOpenGLError.h"
#include "vtkOpenGLRenderUtilities.h"
#include "vtkProp.h" #include "vtkProp.h"
#include "vtkProperty.h" #include "vtkProperty.h"
#include "vtkRenderer.h" #include "vtkRenderer.h"
...@@ -28,23 +29,11 @@ ...@@ -28,23 +29,11 @@
#include <string> #include <string>
// Define to print debug statements to the OpenGL CS stream (useful for e.g.
// apitrace debugging):
//#define ANNOTATE_STREAM
namespace namespace
{ {
void annotate(const std::string &str) void annotate(const std::string &str)
{ {
#ifdef ANNOTATE_STREAM vtkOpenGLRenderUtilities::MarkDebugEvent(str);
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
} }
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "vtkDataObject.h" #include "vtkDataObject.h"
#include "vtkRenderer.h" #include "vtkRenderer.h"
#include "vtkRenderWindow.h" #include "vtkRenderWindow.h"
#include "vtkOpenGLRenderUtilities.h"
#include "vtkOpenGLRenderWindow.h" #include "vtkOpenGLRenderWindow.h"
#include "vtkOpenGLError.h" #include "vtkOpenGLError.h"
...@@ -35,23 +36,11 @@ ...@@ -35,23 +36,11 @@
#define ID_OFFSET 1 #define ID_OFFSET 1
// Define to print debug statements to the OpenGL CS stream (useful for e.g.
// apitrace debugging):
//#define ANNOTATE_STREAM
namespace namespace
{ {
void annotate(const std::string &str) void annotate(const std::string &str)
{ {
#ifdef ANNOTATE_STREAM vtkOpenGLRenderUtilities::MarkDebugEvent(str);
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
} }
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "vtkOpenGLBufferObject.h" #include "vtkOpenGLBufferObject.h"
#include "vtkOpenGLError.h" #include "vtkOpenGLError.h"
#include "vtkOpenGLVertexArrayObject.h" #include "vtkOpenGLVertexArrayObject.h"
#include "vtkRenderingOpenGLConfigure.h"
#include "vtkShaderProgram.h" #include "vtkShaderProgram.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -197,15 +198,13 @@ void vtkOpenGLRenderUtilities::DrawFullScreenQuad() ...@@ -197,15 +198,13 @@ void vtkOpenGLRenderUtilities::DrawFullScreenQuad()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void vtkOpenGLRenderUtilities::MarkDebugEvent(const std::string &event) void vtkOpenGLRenderUtilities::MarkDebugEvent(const std::string &event)
{ {
static bool hasDebugging = (glDebugMessageInsert != nullptr); #ifndef VTK_OPENGL_ENABLE_STREAM_ANNOTATIONS
if (!hasDebugging) (void)event;
{ #else // VTK_OPENGL_ENABLE_STREAM_ANNOTATIONS
return;
}
vtkOpenGLStaticCheckErrorMacro("Error before glDebugMessageInsert.") vtkOpenGLStaticCheckErrorMacro("Error before glDebugMessageInsert.")
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER,
GL_DEBUG_SEVERITY_NOTIFICATION, GL_DEBUG_SEVERITY_NOTIFICATION,
0, static_cast<GLsizei>(event.size()), event.c_str()); 0, static_cast<GLsizei>(event.size()), event.c_str());
vtkOpenGLClearErrorMacro(); vtkOpenGLClearErrorMacro();
#endif // VTK_OPENGL_ENABLE_STREAM_ANNOTATIONS
} }
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#cmakedefine VTK_OPENGL_HAS_OSMESA #cmakedefine VTK_OPENGL_HAS_OSMESA
#cmakedefine VTK_OPENGL_HAS_EGL #cmakedefine VTK_OPENGL_HAS_EGL
#cmakedefine VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN #cmakedefine VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN
#cmakedefine VTK_OPENGL_ENABLE_STREAM_ANNOTATIONS
// for legacy codes (don't use these in new codes) // for legacy codes (don't use these in new codes)
#ifdef VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN #ifdef VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "vtkOpenGLError.h" #include "vtkOpenGLError.h"
#include "vtkOpenGLFramebufferObject.h" #include "vtkOpenGLFramebufferObject.h"
#include "vtkOpenGLIndexBufferObject.h" #include "vtkOpenGLIndexBufferObject.h"
#include "vtkOpenGLRenderUtilities.h"
#include "vtkOpenGLRenderWindow.h" #include "vtkOpenGLRenderWindow.h"
#include "vtkOpenGLShaderCache.h" #include "vtkOpenGLShaderCache.h"
#include "vtkOpenGLVertexArrayObject.h" #include "vtkOpenGLVertexArrayObject.h"
...@@ -62,21 +63,11 @@ ...@@ -62,21 +63,11 @@
#include "vtkglProjectedTetrahedraVS.h" #include "vtkglProjectedTetrahedraVS.h"
#include "vtkglProjectedTetrahedraFS.h" #include "vtkglProjectedTetrahedraFS.h"
// Define to print debug statements to the OpenGL CS stream (useful for e.g.
// apitrace debugging):
// #define ANNOTATE_STREAM
namespace namespace
{ {
void annotate(const std::string& message) void annotate(const std::string& message)
{ {
#ifdef ANNOTATE_STREAM vtkOpenGLRenderUtilities::MarkDebugEvent(message);
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
} }
class scoped_annotate 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