Fixed debug GL functions on windows (amend)
- Removed the dependency on windows.h for windows. I feel it's an unnecessarily large dependency to have to add to all source files when the only thing that's needed to make the windows version compile the debug functions is just the __stdcall call convention keyword. On top of increasing compile time due to the large number of headers it includes from all the windows API headers, it also adds a lot of potential name conflicts, as I was getting a number of name conflicts for lots of names like near/far, which were used in old legacy 16bit windows code.master
parent
8073b0ecd4
commit
156009cc0c
|
@ -44,13 +44,19 @@ static const char* debug_severity_table[] = {
|
|||
"Low"
|
||||
};
|
||||
|
||||
/* ARB and core values are the same. They'll always be linear so no hardcoding. */
|
||||
/* The values subtracted are the lowest value in the list of valid values. */
|
||||
/* ARB and core values are the same. They'll always be linear so no hardcoding.
|
||||
* The values subtracted are the lowest value in the list of valid values. */
|
||||
#define GL_DEBUG_SOURCE_OFFSET(x) (x - GL_DEBUG_SOURCE_API_ARB)
|
||||
#define GL_DEBUG_TYPE_OFFSET(x) (x - GL_DEBUG_TYPE_ERROR_ARB)
|
||||
#define GL_DEBUG_SEVERITY_OFFSET(x) (x - GL_DEBUG_SEVERITY_HIGH_ARB)
|
||||
|
||||
static APIENTRY void gl_debug_proc(
|
||||
#ifdef _WIN32
|
||||
#define GLEW_TEMP_API __stdcall
|
||||
#else
|
||||
#define GLEW_TEMP_API
|
||||
#endif
|
||||
|
||||
static void GLEW_TEMP_API gl_debug_proc(
|
||||
GLenum source, GLenum type, GLuint id, GLenum severity,
|
||||
GLsizei length, const GLchar *message, GLvoid *data )
|
||||
{
|
||||
|
@ -72,7 +78,8 @@ static void gl_enable_debug()
|
|||
else if (GLEW_ARB_debug_output)
|
||||
glDebugMessageCallbackARB(gl_debug_proc, NULL);
|
||||
else {
|
||||
blog(LOG_DEBUG, "Failed to set GL debug callback as it is not supported.");
|
||||
blog(LOG_DEBUG, "Failed to set GL debug callback as it is "
|
||||
"not supported.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -89,14 +96,16 @@ static inline void required_extension_error(const char *extension)
|
|||
static bool gl_init_extensions(struct gs_device* device)
|
||||
{
|
||||
if (!GLEW_VERSION_2_1) {
|
||||
blog(LOG_ERROR, "obs-studio requires OpenGL version 2.1 or higher.");
|
||||
blog(LOG_ERROR, "obs-studio requires OpenGL version 2.1 or "
|
||||
"higher.");
|
||||
return false;
|
||||
}
|
||||
|
||||
gl_enable_debug();
|
||||
|
||||
if (!GLEW_VERSION_3_0 && !GLEW_ARB_framebuffer_object) {
|
||||
blog(LOG_ERROR, "OpenGL extension ARB_framebuffer_object is required.");
|
||||
blog(LOG_ERROR, "OpenGL extension ARB_framebuffer_object "
|
||||
"is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -105,7 +114,8 @@ static bool gl_init_extensions(struct gs_device* device)
|
|||
}
|
||||
|
||||
if (!GLEW_VERSION_4_1 && !GLEW_ARB_separate_shader_objects) {
|
||||
blog(LOG_ERROR, "OpenGL extension ARB_separate_shader_objects is required.");
|
||||
blog(LOG_ERROR, "OpenGL extension ARB_separate_shader_objects "
|
||||
"is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
#include <GL/glew.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "gl-helpers.h"
|
||||
#include "gl-exports.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue