Commit 57607c96 authored by Robert Menzel's avatar Robert Menzel

initial version with basic KHR_debug emulator

parent a47ebb95
......@@ -9,19 +9,9 @@
#include <ACGL/ACGL.hh>
#include <ACGL/OpenGL/GL.hh>
#if (ACGL_OPENGL_VERSION < 43)
#define ACGL_EMULATE_KHR_DEBUG
#endif
namespace ACGL{
namespace OpenGL{
//! will just call the gl version unless ACGL_EMULATE_KHR_DEBUG is defined
void acglDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* buf);
//! will just call the gl version unless ACGL_EMULATE_KHR_DEBUG is defined
void acglDebugMessageCallback(GLDEBUGPROC callback, const void* userParam);
//! converts a KHR debug source enum to a human readable string
const char *debugSourceName( GLenum _source );
......
......@@ -60,11 +60,6 @@
// To compare the OpenGL version number we define a new ACGL_OPENGL_VERSION XY define here
// analog to ACGL_OPENGL_VERSION_XY
//
// used internally only:
#define ACGL_LATEST_SUPPORTED_OPENGL_VERSION ACGL_OPENGL_VERSION_44
// OpenGL ES 2.0 is the default for embedded:
#ifdef ACGL_OPENGL_ES
# if defined (ACGL_OPENGLES_VERSION_30)
......@@ -130,6 +125,8 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CHECKGLERROR();
#ifdef ACGL_OPENGL_ES
// ES does not know 64bit ints but we need them for the Buffer class:
#include <stdint.h>
......@@ -190,9 +187,7 @@
// The selection could also be done with some preprocessor magic but it confuses most IDEs.
//
#ifdef ACGL_OPENGL_PROFILE_CORE
#if defined (ACGL_OPENGL_INCLUDE_LATEST_GL) || defined (ACGL_LATEST_SUPPORTED_OPENGL_VERSION)
#include <ACGL/OpenGL/glloaders/gl_core_43.hh>
#elif defined (ACGL_OPENGL_VERSION_32)
#if defined (ACGL_OPENGL_VERSION_32)
#include <ACGL/OpenGL/glloaders/gl_core_32.hh>
#elif defined (ACGL_OPENGL_VERSION_33)
#include <ACGL/OpenGL/glloaders/gl_core_33.hh>
......@@ -209,14 +204,12 @@
#endif
#else
// compatibility profile:
#if defined (ACGL_OPENGL_INCLUDE_LATEST_GL) || defined (ACGL_LATEST_SUPPORTED_OPENGL_VERSION)
#include <ACGL/OpenGL/glloaders/gl_compatibility_43.hh>
#elif defined (ACGL_OPENGL_VERSION_21)
#include <ACGL/OpenGL/glloaders/gl_21.hh>
#if defined (ACGL_OPENGL_VERSION_21)
#include <ACGL/OpenGL/glloaders/gl_compatibility_21.hh>
#elif defined (ACGL_OPENGL_VERSION_30)
#include <ACGL/OpenGL/glloaders/gl_30.hh>
#include <ACGL/OpenGL/glloaders/gl_compatibility_30.hh>
#elif defined (ACGL_OPENGL_VERSION_31)
#include <ACGL/OpenGL/glloaders/gl_31.hh>
#include <ACGL/OpenGL/glloaders/gl_compatibility_31.hh>
#elif defined (ACGL_OPENGL_VERSION_32)
#include <ACGL/OpenGL/glloaders/gl_compatibility_32.hh>
#elif defined (ACGL_OPENGL_VERSION_33)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -12,40 +12,11 @@
using namespace std;
using namespace ACGL::Utils;
#include <sstream>
namespace ACGL{
namespace OpenGL{
#ifdef ACGL_EMULATE_KHR_DEBUG
GLDEBUGPROC currentDebugCallback = NULL;
const void *currentDebugUserData = NULL;
void acglDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* buf)
{
currentDebugCallback( source, type, id, severity, length, buf, currentDebugUserData );
}
void acglDebugMessageCallback(GLDEBUGPROC callback, const void* userParam)
{
currentDebugCallback = callback;
currentDebugUserData = userParam;
}
#else
void acglDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* buf)
{
glDebugMessageInsert( source, type, id, severity, length, buf);
}
void acglDebugMessageCallback(GLDEBUGPROC callback, const void* userParam)
{
glEnable( GL_DEBUG_OUTPUT_SYNCHRONOUS );
glDebugMessageCallback( callback, userParam);
}
#endif
const char *debugSourceName( GLenum _source )
{
if (_source == GL_DEBUG_SOURCE_API) return "API";
......@@ -80,7 +51,6 @@ const char *debugSeverityName( GLenum _type )
void ACGLRegisterDefaultDebugCallback()
{
#ifndef ACGL_EMULATE_KHR_DEBUG
if (getOpenGLVersionNumber() >= 43 || ACGL_KHR_debug()) {
GLint v;
glGetIntegerv( GL_CONTEXT_FLAGS, &v );
......@@ -90,13 +60,8 @@ void ACGLRegisterDefaultDebugCallback()
debug() << "context was created WITHOUT debug capabilities - registering a debug callback is possible but might not result in getting called even if errors occur!" << endl;
}
acglDebugMessageCallback( ACGL_KHR_default_debug_callback, NULL );
glDebugMessageCallback( ACGL_KHR_default_debug_callback, NULL );
}
#else
// the emulation works with every GL version:
debug() << "using emulated debug capabilities - might not catch everything!" << endl;
acglDebugMessageCallback( ACGL_KHR_default_debug_callback, NULL );
#endif
}
//! place a brakepoint in here to find the source of a problem!
......
......@@ -187,11 +187,11 @@ GLenum openGLError_( const char *_fileName, const unsigned long _lineNumber )
// OpenGL does not forbit the implementation to stack up more than one error code
// so we have to check those in a loop:
while ( currentError != GL_NO_ERROR ) {
//ACGL::Utils::error() << "GL error in file " << _fileName << ":" << _lineNumber << " - " << acglErrorString( currentError ) << std::endl;
ACGL::Utils::error() << "GL error in file " << _fileName << ":" << _lineNumber << " - " << acglErrorString( currentError ) << std::endl;
stringstream sstream (stringstream::in | stringstream::out);
sstream << acglErrorString( currentError ) << " in file " << _fileName << ":" << _lineNumber;
acglDebugMessageInsert( GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, currentError, GL_DEBUG_SEVERITY_HIGH, -1, sstream.str().c_str() );
//stringstream sstream (stringstream::in | stringstream::out);
//sstream << acglErrorString( currentError ) << " in file " << _fileName << ":" << _lineNumber;
//acglDebugMessageInsert( GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, currentError, GL_DEBUG_SEVERITY_HIGH, -1, sstream.str().c_str() );
lastError = currentError;
currentError = glGetError();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -5,6 +5,9 @@
**********************************************************************/
#include <ACGL/OpenGL/GL.hh>
#include <iostream>
using namespace std;
// don't do anything if an other extension loader (e.g. GLEW) should get used:
#ifdef ACGL_EXTENSION_LOADER_GLLOADGEN
......@@ -14,9 +17,7 @@
#endif
#ifdef ACGL_OPENGL_PROFILE_CORE
#if defined (ACGL_OPENGL_INCLUDE_LATEST_GL) || defined (ACGL_LATEST_SUPPORTED_OPENGL_VERSION)
#include "gl_core_44.inc"
#elif defined (ACGL_OPENGL_VERSION_32)
#if defined (ACGL_OPENGL_VERSION_32)
#include "gl_core_32.inc"
#elif defined (ACGL_OPENGL_VERSION_33)
#include "gl_core_33.inc"
......@@ -35,9 +36,7 @@
#endif
#else
// compatibility profile:
#if defined (ACGL_OPENGL_INCLUDE_LATEST_GL) || defined (ACGL_LATEST_SUPPORTED_OPENGL_VERSION)
#include "gl_compatibility_44.inc"
#elif defined (ACGL_OPENGL_VERSION_21)
#if defined (ACGL_OPENGL_VERSION_21)
#include "gl_compatibility_21.inc"
#elif defined (ACGL_OPENGL_VERSION_30)
#include "gl_compatibility_30.inc"
......
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