add version of gl debug callback for not-windows
also add note for differing signature, look into why this "works" on windows and doesnt on linux later.. seems potentially bad
This commit is contained in:
parent
84decfb48f
commit
d8e79f0658
|
@ -29,24 +29,45 @@ struct Window {
|
||||||
SDL_Window* window;
|
SDL_Window* window;
|
||||||
SDL_GLContext context;
|
SDL_GLContext context;
|
||||||
|
|
||||||
extern(Windows) nothrow @nogc
|
version(Windows) {
|
||||||
static void openGLCallbackFunction(
|
extern(Windows) nothrow @nogc
|
||||||
GLenum source, GLenum type,
|
static void openGLCallbackFunction(
|
||||||
GLuint id, GLenum severity,
|
GLenum source, GLenum type,
|
||||||
GLsizei length, const (GLchar)* message,
|
GLuint id, GLenum severity,
|
||||||
void* userParam)
|
GLsizei length, const (GLchar)* message,
|
||||||
{
|
void* userParam)
|
||||||
|
{
|
||||||
|
|
||||||
printf("Message: %s \nSource: %s \nType: %s \nID: %d \nSeverity: %s\n\n",
|
printf("Message: %s \nSource: %s \nType: %s \nID: %d \nSeverity: %s\n\n",
|
||||||
message, to!(char*)(source), to!(char*)(type), id, to!(char*)(severity));
|
message, to!(char*)(source), to!(char*)(type), id, to!(char*)(severity));
|
||||||
|
|
||||||
if (severity == GL_DEBUG_SEVERITY_HIGH) {
|
if (severity == GL_DEBUG_SEVERITY_HIGH) {
|
||||||
printf("Aborting...\n");
|
printf("Aborting...\n");
|
||||||
import core.stdc.stdlib : exit;
|
import core.stdc.stdlib : exit;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // openGLCallbackFunction
|
} // openGLCallbackFunction
|
||||||
|
} else {
|
||||||
|
extern(C) nothrow @nogc
|
||||||
|
static void openGLCallbackFunction(
|
||||||
|
GLenum source, GLenum type,
|
||||||
|
GLuint id, GLenum severity,
|
||||||
|
GLsizei length, const (GLchar*) message, // TODO: look at why it's GLchar* for non-windows and the other works on windows..
|
||||||
|
void* userParam)
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("Message: %s \nSource: %s \nType: %s \nID: %d \nSeverity: %s\n\n",
|
||||||
|
message, to!(char*)(source), to!(char*)(type), id, to!(char*)(severity));
|
||||||
|
|
||||||
|
if (severity == GL_DEBUG_SEVERITY_HIGH) {
|
||||||
|
printf("Aborting...\n");
|
||||||
|
import core.stdc.stdlib : exit;
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // openGLCallbackFunction
|
||||||
|
}
|
||||||
|
|
||||||
void createWindow(int w, int h, const char* title = "Chipd8 Emu") {
|
void createWindow(int w, int h, const char* title = "Chipd8 Emu") {
|
||||||
assert(w > 0, "window width must be > 0");
|
assert(w > 0, "window width must be > 0");
|
||||||
|
@ -177,4 +198,4 @@ const (char*) to(T : char*)(GLenum value) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // to!string(GLenum)
|
} // to!string(GLenum)
|
||||||
|
|
Loading…
Reference in New Issue