mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-18 05:33:52 +01:00
Add debug handler
This commit is contained in:
parent
8c521939b9
commit
1f750cd7b2
@ -393,6 +393,7 @@ bool CIrrDeviceSDL::createWindow()
|
|||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG | SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG);
|
||||||
if (CreationParams.Bits == 16) {
|
if (CreationParams.Bits == 16) {
|
||||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 4);
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 4);
|
||||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 4);
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 4);
|
||||||
|
@ -31,6 +31,16 @@ namespace irr
|
|||||||
namespace video
|
namespace video
|
||||||
{
|
{
|
||||||
|
|
||||||
|
void APIENTRY COpenGL3Driver::debugCb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam)
|
||||||
|
{
|
||||||
|
((COpenGL3Driver *)userParam)->debugCb(source, type, id, severity, length, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void COpenGL3Driver::debugCb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message)
|
||||||
|
{
|
||||||
|
printf("%04x %04x %x %x %.*s\n", source, type, id, severity, length, message);
|
||||||
|
}
|
||||||
|
|
||||||
COpenGL3Driver::COpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager) :
|
COpenGL3Driver::COpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager) :
|
||||||
CNullDriver(io, params.WindowSize), COpenGL3ExtensionHandler(), CacheHandler(0),
|
CNullDriver(io, params.WindowSize), COpenGL3ExtensionHandler(), CacheHandler(0),
|
||||||
Params(params), ResetRenderStates(true), LockRenderStateMode(false), AntiAlias(params.AntiAlias),
|
Params(params), ResetRenderStates(true), LockRenderStateMode(false), AntiAlias(params.AntiAlias),
|
||||||
@ -52,6 +62,7 @@ COpenGL3Driver::COpenGL3Driver(const SIrrlichtCreationParameters& params, io::IF
|
|||||||
ExposedData = ContextManager->getContext();
|
ExposedData = ContextManager->getContext();
|
||||||
ContextManager->activateContext(ExposedData, false);
|
ContextManager->activateContext(ExposedData, false);
|
||||||
GL.LoadAllProcedures(ContextManager);
|
GL.LoadAllProcedures(ContextManager);
|
||||||
|
GL.DebugMessageCallback(debugCb, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
COpenGL3Driver::~COpenGL3Driver()
|
COpenGL3Driver::~COpenGL3Driver()
|
||||||
|
@ -397,6 +397,9 @@ private:
|
|||||||
ECOLOR_FORMAT ColorFormat;
|
ECOLOR_FORMAT ColorFormat;
|
||||||
|
|
||||||
IContextManager* ContextManager;
|
IContextManager* ContextManager;
|
||||||
|
|
||||||
|
void debugCb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message);
|
||||||
|
static void APIENTRY debugCb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
Loading…
Reference in New Issue
Block a user