Commit 29d22745 authored by Robert Menzel's avatar Robert Menzel
Browse files

windows compatibility and fixed opengl version detection

parent 65e63f05
......@@ -182,11 +182,11 @@ DebugGroupDescription g_DebugGroupDescriptions[ KHR_DEBUG_EMULATOR_MAX_DEBUG_GRO
//
GLboolean isValidSeverity( GLenum e );
GLboolean isValidType( GLenum e );
void KHR_DEBUG_EMULATOR_DebugMessageInsert_internal(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf);
void APIENTRY KHR_DEBUG_EMULATOR_DebugMessageInsert_internal(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf);
// returns true if the message should not get ignored by the rules defined by glDebugMessageControl:
GLboolean shouldMessageGetProcessed( GLenum source, GLenum type, GLuint id, GLenum severity );
void KHR_DEBUG_EMULATOR_DebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf)
void APIENTRY KHR_DEBUG_EMULATOR_DebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf)
{
if (KHR_DEBUG_EMULATOR_isEnabled == 0) return;
......@@ -198,7 +198,7 @@ void KHR_DEBUG_EMULATOR_DebugMessageInsert(GLenum source, GLenum type, GLuint id
KHR_DEBUG_EMULATOR_DebugMessageInsert_internal( source, type, id, severity, length, buf );
}
void KHR_DEBUG_EMULATOR_DebugMessageInsert_internal(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf)
void APIENTRY KHR_DEBUG_EMULATOR_DebugMessageInsert_internal(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf)
{
if (KHR_DEBUG_EMULATOR_isEnabled == 0) return;
......@@ -246,7 +246,7 @@ void KHR_DEBUG_EMULATOR_DebugMessageInsert_internal(GLenum source, GLenum type,
/////////////////////////////
GLboolean debugContextIsSimulated();
void KHR_DEBUG_EMULATOR_DebugMessageCallback(GLDEBUGPROC callback, const void * userParam)
void APIENTRY KHR_DEBUG_EMULATOR_DebugMessageCallback(GLDEBUGPROC callback, const void * userParam)
{
KHR_DEBUG_EMULATOR_callback = callback;
KHR_DEBUG_EMULATOR_userParam = userParam;
......@@ -269,7 +269,7 @@ GLboolean shouldMessageGetProcessed( GLenum source, GLenum type, GLuint id, GLen
// adds a new rule:
void addRule( DebugMessageControlRule *newRule );
void KHR_DEBUG_EMULATOR_DebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled)
void APIENTRY KHR_DEBUG_EMULATOR_DebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled)
{
DebugMessageControlRule *rule = (DebugMessageControlRule*) malloc( sizeof(DebugMessageControlRule) );
rule->source = source;
......@@ -303,7 +303,7 @@ void KHR_DEBUG_EMULATOR_DebugMessageControl(GLenum source, GLenum type, GLenum s
/////////////////////////////
/// glGetDebugMessageLog
/////////////////////////////
GLuint KHR_DEBUG_EMULATOR_GetDebugMessageLog(GLuint count, GLsizei bufsize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog)
GLuint APIENTRY KHR_DEBUG_EMULATOR_GetDebugMessageLog(GLuint count, GLsizei bufsize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog)
{
if (bufsize < 0 && messageLog != NULL) {
INSERT_API_ERROR( GL_INVALID_VALUE , "invalid value in glGetDebugMessageLog: bufsize < 0 and messageLog != NULL" );
......@@ -350,7 +350,7 @@ void insertObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLc
//
// TODO: check if name is a valid object, emit an INVALID_VALUE otherwise
//
void KHR_DEBUG_EMULATOR_ObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar * label)
void APIENTRY KHR_DEBUG_EMULATOR_ObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar * label)
{
if ( !isValidObjectLabelNamespace(identifier) ) {
INSERT_API_ERROR( GL_INVALID_ENUM, "invalid enum in glObjectLabel" );
......@@ -400,7 +400,7 @@ void KHR_DEBUG_EMULATOR_ObjectLabel(GLenum identifier, GLuint name, GLsizei leng
/////////////////////////////
/// glGetObjectLabel
/////////////////////////////
void KHR_DEBUG_EMULATOR_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label)
void APIENTRY KHR_DEBUG_EMULATOR_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label)
{
if ( !isValidObjectLabelNamespace(identifier) ) {
INSERT_API_ERROR( GL_INVALID_ENUM, "invalid enum in glObjectGetLabel" );
......@@ -438,7 +438,7 @@ void KHR_DEBUG_EMULATOR_GetObjectLabel(GLenum identifier, GLuint name, GLsizei b
ObjectPtrLabel *findObjectPtrLabel(const void * ptr);
void insertObjectPtrLabel(const void * ptr, GLsizei length, const GLchar * label);
void KHR_DEBUG_EMULATOR_ObjectPtrLabel(const void * ptr, GLsizei length, const GLchar * label)
void APIENTRY KHR_DEBUG_EMULATOR_ObjectPtrLabel(const void * ptr, GLsizei length, const GLchar * label)
{
if (length < 0) {
length = strlen( label );
......@@ -483,7 +483,7 @@ void KHR_DEBUG_EMULATOR_ObjectPtrLabel(const void * ptr, GLsizei length, const G
/////////////////////////////
/// glGetObjectPtrLabel
/////////////////////////////
void KHR_DEBUG_EMULATOR_GetObjectPtrLabel(const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label)
void APIENTRY KHR_DEBUG_EMULATOR_GetObjectPtrLabel(const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label)
{
ObjectPtrLabel *thelabel = findObjectPtrLabel( ptr );
if (thelabel == NULL) {
......@@ -512,7 +512,7 @@ void KHR_DEBUG_EMULATOR_GetObjectPtrLabel(const void * ptr, GLsizei bufSize, GLs
/////////////////////////////
/// glPopDebugGroup
/////////////////////////////
void KHR_DEBUG_EMULATOR_PopDebugGroup()
void APIENTRY KHR_DEBUG_EMULATOR_PopDebugGroup()
{
if (g_DebugGroupNumber == 0) {
INSERT_API_ERROR( GL_STACK_UNDERFLOW, "stack underflow in glPushDebugGroup: can't pop default group" );
......@@ -554,7 +554,7 @@ void KHR_DEBUG_EMULATOR_PopDebugGroup()
/////////////////////////////
/// glPushDebugGroup
/////////////////////////////
void KHR_DEBUG_EMULATOR_PushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar * message)
void APIENTRY KHR_DEBUG_EMULATOR_PushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar * message)
{
if ((source != GL_DEBUG_SOURCE_APPLICATION) && (source != GL_DEBUG_SOURCE_THIRD_PARTY)) {
INSERT_API_ERROR( GL_INVALID_ENUM, "invalid enum in glPushDebugGroup: source has to be GL_DEBUG_SOURCE_APPLICATION or GL_DEBUG_SOURCE_THIRD_PARTY" );
......@@ -592,7 +592,7 @@ void KHR_DEBUG_EMULATOR_PushDebugGroup(GLenum source, GLuint id, GLsizei length,
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
void KHR_DEBUG_EMULATOR_CHECK_GL_ERROR();
void APIENTRY KHR_DEBUG_EMULATOR_CHECK_GL_ERROR();
//
// glGetError
......@@ -613,7 +613,7 @@ GLenum KHR_DEBUG_EMULATOR_GetError() {
// glDisable | glEnable | glIsEnabled
// need to recognize GL_DEBUG_OUTPUT & GL_DEBUG_OUTPUT_SYNCHRONOUS
//
void KHR_DEBUG_EMULATOR_Disable(GLenum cap){
void APIENTRY KHR_DEBUG_EMULATOR_Disable(GLenum cap){
if (cap == GL_DEBUG_OUTPUT) {
KHR_DEBUG_EMULATOR_isEnabled = 0;
return;
......@@ -626,7 +626,7 @@ void KHR_DEBUG_EMULATOR_Disable(GLenum cap){
KHR_DEBUG_EMULATOR_CHECK_GL_ERROR();
}
void KHR_DEBUG_EMULATOR_Enable(GLenum cap){
void APIENTRY KHR_DEBUG_EMULATOR_Enable(GLenum cap){
if (cap == GL_DEBUG_OUTPUT) {
KHR_DEBUG_EMULATOR_isEnabled = 1;
return;
......@@ -640,7 +640,7 @@ void KHR_DEBUG_EMULATOR_Enable(GLenum cap){
KHR_DEBUG_EMULATOR_CHECK_GL_ERROR();
}
GLboolean KHR_DEBUG_EMULATOR_IsEnabled(GLenum cap){
GLboolean APIENTRY KHR_DEBUG_EMULATOR_IsEnabled(GLenum cap){
if (cap == GL_DEBUG_OUTPUT) {
return (KHR_DEBUG_EMULATOR_isEnabled == 1);
}
......@@ -657,7 +657,7 @@ GLboolean KHR_DEBUG_EMULATOR_IsEnabled(GLenum cap){
// glGetIntegerv
// needs to recognize a few new tokens
//
void KHR_DEBUG_EMULATOR_GetIntegerv(GLenum pname, GLint * params){
void APIENTRY KHR_DEBUG_EMULATOR_GetIntegerv(GLenum pname, GLint * params){
if (pname == GL_CONTEXT_FLAGS) {
_original_glGetIntegerv(pname, params);
......@@ -689,7 +689,7 @@ void KHR_DEBUG_EMULATOR_GetIntegerv(GLenum pname, GLint * params){
// glGetPointerv
// needs to recognize GL_DEBUG_CALLBACK_FUNCTION & GL_DEBUG_CALLBACK_USER_PARAM
//
void KHR_DEBUG_EMULATOR_GetPointerv( GLenum pname, GLvoid ** params ){
void APIENTRY KHR_DEBUG_EMULATOR_GetPointerv( GLenum pname, GLvoid ** params ){
if (pname == GL_DEBUG_CALLBACK_FUNCTION) {
*params = (GLvoid*) KHR_DEBUG_EMULATOR_callback;
......@@ -707,7 +707,7 @@ void KHR_DEBUG_EMULATOR_GetPointerv( GLenum pname, GLvoid ** params ){
///
///////////////////////////////////////////////////////////////////////////////////////////////////
const char* KHR_DEBUG_EMULATOR_GET_ERROR_STRING( GLenum _errorCode )
const char* APIENTRY KHR_DEBUG_EMULATOR_GET_ERROR_STRING( GLenum _errorCode )
{
if (_errorCode == GL_INVALID_ENUM) { return (char*) "OpenGL error: GL_INVALID_ENUM"; }
else if (_errorCode == GL_INVALID_VALUE) { return (char*) "OpenGL error: GL_INVALID_VALUE"; }
......@@ -724,7 +724,7 @@ const char* KHR_DEBUG_EMULATOR_GET_ERROR_STRING( GLenum _errorCode )
// internal error check that gets triggered after every GL call
// * check for errors, if there was one, trigger a debug message but store the error code to fake the original glGetError behavior
void KHR_DEBUG_EMULATOR_CHECK_GL_ERROR() {
void APIENTRY KHR_DEBUG_EMULATOR_CHECK_GL_ERROR() {
//printf("check error\n");
GLenum currentError = _original_glGetError();
if ( currentError != GL_NO_ERROR ) {
......
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.
Supports Markdown
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