mirror of
https://github.com/minetest/minetest.git
synced 2025-01-24 23:11:31 +01:00
Expose OpenGL debugging as a normal setting
This commit is contained in:
parent
ecfe9c5c2f
commit
7a6ca85081
@ -1893,6 +1893,9 @@ texture_min_size (Base texture size) int 64 1 32768
|
|||||||
# Systems with a low-end GPU (or no GPU) would benefit from smaller values.
|
# Systems with a low-end GPU (or no GPU) would benefit from smaller values.
|
||||||
client_mesh_chunk (Client Mesh Chunksize) int 1 1 16
|
client_mesh_chunk (Client Mesh Chunksize) int 1 1 16
|
||||||
|
|
||||||
|
# Enables debug and error-checking in the OpenGL driver.
|
||||||
|
opengl_debug (OpenGL debug) bool false
|
||||||
|
|
||||||
[**Sound]
|
[**Sound]
|
||||||
# Comma-separated list of AL and ALC extensions that should not be used.
|
# Comma-separated list of AL and ALC extensions that should not be used.
|
||||||
# Useful for testing. See al_extensions.[h,cpp] for details.
|
# Useful for testing. See al_extensions.[h,cpp] for details.
|
||||||
|
@ -45,10 +45,11 @@ struct SIrrlichtCreationParameters
|
|||||||
#endif
|
#endif
|
||||||
PrivateData(0),
|
PrivateData(0),
|
||||||
#ifdef IRR_MOBILE_PATHS
|
#ifdef IRR_MOBILE_PATHS
|
||||||
OGLES2ShaderPath("media/Shaders/")
|
OGLES2ShaderPath("media/Shaders/"),
|
||||||
#else
|
#else
|
||||||
OGLES2ShaderPath("../../media/Shaders/")
|
OGLES2ShaderPath("../../media/Shaders/"),
|
||||||
#endif
|
#endif
|
||||||
|
DriverDebug(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,6 +225,9 @@ struct SIrrlichtCreationParameters
|
|||||||
/** This is about the shaders which can be found in media/Shaders by default. It's only necessary
|
/** This is about the shaders which can be found in media/Shaders by default. It's only necessary
|
||||||
to set when using OGL-ES 2.0 */
|
to set when using OGL-ES 2.0 */
|
||||||
irr::io::path OGLES2ShaderPath;
|
irr::io::path OGLES2ShaderPath;
|
||||||
|
|
||||||
|
//! Enable debug and error checks in video driver.
|
||||||
|
bool DriverDebug;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace irr
|
} // end namespace irr
|
||||||
|
@ -529,7 +529,8 @@ bool CEGLManager::swapBuffers()
|
|||||||
|
|
||||||
bool CEGLManager::testEGLError()
|
bool CEGLManager::testEGLError()
|
||||||
{
|
{
|
||||||
#if defined(EGL_VERSION_1_0) && defined(_DEBUG)
|
if (!Params.DriverDebug)
|
||||||
|
return false;
|
||||||
EGLint status = eglGetError();
|
EGLint status = eglGetError();
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -582,9 +583,6 @@ bool CEGLManager::testEGLError()
|
|||||||
};
|
};
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -388,6 +388,16 @@ bool CIrrDeviceSDL::createWindow()
|
|||||||
if (createWindowWithContext())
|
if (createWindowWithContext())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (CreationParams.DriverDebug) {
|
||||||
|
CreationParams.DriverDebug = false;
|
||||||
|
if (createWindowWithContext()) {
|
||||||
|
os::Printer::log("DriverDebug reduced due to lack of support!");
|
||||||
|
// Turn it back on because the GL driver can maybe still do something useful.
|
||||||
|
CreationParams.DriverDebug = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (CreationParams.AntiAlias > 0) {
|
while (CreationParams.AntiAlias > 0) {
|
||||||
CreationParams.AntiAlias--;
|
CreationParams.AntiAlias--;
|
||||||
if (createWindowWithContext()) {
|
if (createWindowWithContext()) {
|
||||||
@ -449,7 +459,8 @@ bool CIrrDeviceSDL::createWindow()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CIrrDeviceSDL::createWindowWithContext() {
|
bool CIrrDeviceSDL::createWindowWithContext()
|
||||||
|
{
|
||||||
u32 SDL_Flags = 0;
|
u32 SDL_Flags = 0;
|
||||||
|
|
||||||
if (CreationParams.Fullscreen) {
|
if (CreationParams.Fullscreen) {
|
||||||
@ -465,6 +476,8 @@ bool CIrrDeviceSDL::createWindowWithContext() {
|
|||||||
SDL_Flags |= SDL_WINDOW_MAXIMIZED;
|
SDL_Flags |= SDL_WINDOW_MAXIMIZED;
|
||||||
SDL_Flags |= SDL_WINDOW_OPENGL;
|
SDL_Flags |= SDL_WINDOW_OPENGL;
|
||||||
|
|
||||||
|
SDL_GL_ResetAttributes();
|
||||||
|
|
||||||
#ifdef _IRR_EMSCRIPTEN_PLATFORM_
|
#ifdef _IRR_EMSCRIPTEN_PLATFORM_
|
||||||
if (Width != 0 || Height != 0)
|
if (Width != 0 || Height != 0)
|
||||||
emscripten_set_canvas_size(Width, Height);
|
emscripten_set_canvas_size(Width, Height);
|
||||||
@ -528,13 +541,9 @@ bool CIrrDeviceSDL::createWindowWithContext() {
|
|||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (CreationParams.DriverDebug) {
|
||||||
Makes context creation fail on some Android devices.
|
|
||||||
See discussion in https://github.com/minetest/minetest/pull/14498.
|
|
||||||
#ifdef _DEBUG
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG | SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG | SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG);
|
||||||
#endif
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
if (CreationParams.Bits == 16) {
|
if (CreationParams.Bits == 16) {
|
||||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||||
|
@ -1177,7 +1177,9 @@ void COGLES1Driver::setMaterial(const SMaterial &material)
|
|||||||
//! prints error if an error happened.
|
//! prints error if an error happened.
|
||||||
bool COGLES1Driver::testGLError(int code)
|
bool COGLES1Driver::testGLError(int code)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
if (!Params.DriverDebug)
|
||||||
|
return false;
|
||||||
|
|
||||||
GLenum g = glGetError();
|
GLenum g = glGetError();
|
||||||
switch (g) {
|
switch (g) {
|
||||||
case GL_NO_ERROR:
|
case GL_NO_ERROR:
|
||||||
@ -1201,11 +1203,7 @@ bool COGLES1Driver::testGLError(int code)
|
|||||||
os::Printer::log("GL_OUT_OF_MEMORY", core::stringc(code).c_str(), ELL_ERROR);
|
os::Printer::log("GL_OUT_OF_MEMORY", core::stringc(code).c_str(), ELL_ERROR);
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
// _IRR_DEBUG_BREAK_IF(true);
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sets the needed renderstates
|
//! sets the needed renderstates
|
||||||
|
@ -1642,7 +1642,9 @@ void COpenGLDriver::setMaterial(const SMaterial &material)
|
|||||||
//! prints error if an error happened.
|
//! prints error if an error happened.
|
||||||
bool COpenGLDriver::testGLError(int code)
|
bool COpenGLDriver::testGLError(int code)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
if (!Params.DriverDebug)
|
||||||
|
return false;
|
||||||
|
|
||||||
GLenum g = glGetError();
|
GLenum g = glGetError();
|
||||||
switch (g) {
|
switch (g) {
|
||||||
case GL_NO_ERROR:
|
case GL_NO_ERROR:
|
||||||
@ -1674,11 +1676,7 @@ bool COpenGLDriver::testGLError(int code)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
// _IRR_DEBUG_BREAK_IF(true);
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sets the needed renderstates
|
//! sets the needed renderstates
|
||||||
|
@ -179,9 +179,8 @@ bool CWGLManager::initialize(const SIrrlichtCreationParameters ¶ms, const SE
|
|||||||
const bool pixel_format_supported = (wglExtensions.find("WGL_ARB_pixel_format") != -1);
|
const bool pixel_format_supported = (wglExtensions.find("WGL_ARB_pixel_format") != -1);
|
||||||
const bool multi_sample_supported = ((wglExtensions.find("WGL_ARB_multisample") != -1) ||
|
const bool multi_sample_supported = ((wglExtensions.find("WGL_ARB_multisample") != -1) ||
|
||||||
(wglExtensions.find("WGL_EXT_multisample") != -1) || (wglExtensions.find("WGL_3DFX_multisample") != -1));
|
(wglExtensions.find("WGL_EXT_multisample") != -1) || (wglExtensions.find("WGL_3DFX_multisample") != -1));
|
||||||
#ifdef _DEBUG
|
if (params.DriverDebug)
|
||||||
os::Printer::log("WGL_extensions", wglExtensions);
|
os::Printer::log("WGL_extensions", wglExtensions);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Without a GL context we can't call wglGetProcAddress so store this for later
|
// Without a GL context we can't call wglGetProcAddress so store this for later
|
||||||
FunctionPointers[0] = (void *)wglGetProcAddress("wglCreateContextAttribsARB");
|
FunctionPointers[0] = (void *)wglGetProcAddress("wglCreateContextAttribsARB");
|
||||||
|
@ -143,7 +143,7 @@ COpenGL3DriverBase::COpenGL3DriverBase(const SIrrlichtCreationParameters ¶ms
|
|||||||
MaterialRenderer2DActive(0), MaterialRenderer2DTexture(0), MaterialRenderer2DNoTexture(0),
|
MaterialRenderer2DActive(0), MaterialRenderer2DTexture(0), MaterialRenderer2DNoTexture(0),
|
||||||
CurrentRenderMode(ERM_NONE), Transformation3DChanged(true),
|
CurrentRenderMode(ERM_NONE), Transformation3DChanged(true),
|
||||||
OGLES2ShaderPath(params.OGLES2ShaderPath),
|
OGLES2ShaderPath(params.OGLES2ShaderPath),
|
||||||
ColorFormat(ECF_R8G8B8), ContextManager(contextManager)
|
ColorFormat(ECF_R8G8B8), ContextManager(contextManager), EnableErrorTest(params.DriverDebug)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("Driver");
|
setDebugName("Driver");
|
||||||
@ -158,7 +158,10 @@ COpenGL3DriverBase::COpenGL3DriverBase(const SIrrlichtCreationParameters ¶ms
|
|||||||
ExposedData = ContextManager->getContext();
|
ExposedData = ContextManager->getContext();
|
||||||
ContextManager->activateContext(ExposedData, false);
|
ContextManager->activateContext(ExposedData, false);
|
||||||
GL.LoadAllProcedures(ContextManager);
|
GL.LoadAllProcedures(ContextManager);
|
||||||
|
if (EnableErrorTest) {
|
||||||
|
GL.Enable(GL_DEBUG_OUTPUT);
|
||||||
GL.DebugMessageCallback(debugCb, this);
|
GL.DebugMessageCallback(debugCb, this);
|
||||||
|
}
|
||||||
initQuadsIndices();
|
initQuadsIndices();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1125,7 +1128,9 @@ void COpenGL3DriverBase::setMaterial(const SMaterial &material)
|
|||||||
//! prints error if an error happened.
|
//! prints error if an error happened.
|
||||||
bool COpenGL3DriverBase::testGLError(int code)
|
bool COpenGL3DriverBase::testGLError(int code)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
if (!EnableErrorTest)
|
||||||
|
return false;
|
||||||
|
|
||||||
GLenum g = GL.GetError();
|
GLenum g = GL.GetError();
|
||||||
switch (g) {
|
switch (g) {
|
||||||
case GL_NO_ERROR:
|
case GL_NO_ERROR:
|
||||||
@ -1144,66 +1149,6 @@ bool COpenGL3DriverBase::testGLError(int code)
|
|||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//! prints error if an error happened.
|
|
||||||
bool COpenGL3DriverBase::testEGLError()
|
|
||||||
{
|
|
||||||
#if defined(EGL_VERSION_1_0) && defined(_DEBUG)
|
|
||||||
EGLint g = eglGetError();
|
|
||||||
switch (g) {
|
|
||||||
case EGL_SUCCESS:
|
|
||||||
return false;
|
|
||||||
case EGL_NOT_INITIALIZED:
|
|
||||||
os::Printer::log("Not Initialized", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_ACCESS:
|
|
||||||
os::Printer::log("Bad Access", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_ALLOC:
|
|
||||||
os::Printer::log("Bad Alloc", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_ATTRIBUTE:
|
|
||||||
os::Printer::log("Bad Attribute", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_CONTEXT:
|
|
||||||
os::Printer::log("Bad Context", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_CONFIG:
|
|
||||||
os::Printer::log("Bad Config", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_CURRENT_SURFACE:
|
|
||||||
os::Printer::log("Bad Current Surface", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_DISPLAY:
|
|
||||||
os::Printer::log("Bad Display", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_SURFACE:
|
|
||||||
os::Printer::log("Bad Surface", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_MATCH:
|
|
||||||
os::Printer::log("Bad Match", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_PARAMETER:
|
|
||||||
os::Printer::log("Bad Parameter", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_NATIVE_PIXMAP:
|
|
||||||
os::Printer::log("Bad Native Pixmap", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_BAD_NATIVE_WINDOW:
|
|
||||||
os::Printer::log("Bad Native Window", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
case EGL_CONTEXT_LOST:
|
|
||||||
os::Printer::log("Context Lost", ELL_ERROR);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3DriverBase::setRenderStates3DMode()
|
void COpenGL3DriverBase::setRenderStates3DMode()
|
||||||
|
@ -224,9 +224,6 @@ public:
|
|||||||
//! checks if an OpenGL error has happened and prints it (+ some internal code which is usually the line number)
|
//! checks if an OpenGL error has happened and prints it (+ some internal code which is usually the line number)
|
||||||
bool testGLError(int code = 0);
|
bool testGLError(int code = 0);
|
||||||
|
|
||||||
//! checks if an OGLES1 error has happened and prints it
|
|
||||||
bool testEGLError();
|
|
||||||
|
|
||||||
//! Set/unset a clipping plane.
|
//! Set/unset a clipping plane.
|
||||||
bool setClipPlane(u32 index, const core::plane3df &plane, bool enable = false) override;
|
bool setClipPlane(u32 index, const core::plane3df &plane, bool enable = false) override;
|
||||||
|
|
||||||
@ -385,7 +382,7 @@ private:
|
|||||||
|
|
||||||
void printTextureFormats();
|
void printTextureFormats();
|
||||||
|
|
||||||
void addDummyMaterial(E_MATERIAL_TYPE type);
|
bool EnableErrorTest;
|
||||||
|
|
||||||
unsigned QuadIndexCount;
|
unsigned QuadIndexCount;
|
||||||
GLuint QuadIndexBuffer = 0;
|
GLuint QuadIndexBuffer = 0;
|
||||||
|
@ -229,6 +229,7 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
|
|||||||
params.Stencilbuffer = false;
|
params.Stencilbuffer = false;
|
||||||
params.Vsync = vsync;
|
params.Vsync = vsync;
|
||||||
params.EventReceiver = receiver;
|
params.EventReceiver = receiver;
|
||||||
|
params.DriverDebug = g_settings->getBool("opengl_debug");
|
||||||
|
|
||||||
// there is no standardized path for these on desktop
|
// there is no standardized path for these on desktop
|
||||||
std::string rel_path = std::string("client") + DIR_DELIM
|
std::string rel_path = std::string("client") + DIR_DELIM
|
||||||
|
@ -114,7 +114,7 @@ void set_default_settings()
|
|||||||
settings->setDefault("keymap_toggle_hud", "KEY_F1");
|
settings->setDefault("keymap_toggle_hud", "KEY_F1");
|
||||||
settings->setDefault("keymap_toggle_chat", "KEY_F2");
|
settings->setDefault("keymap_toggle_chat", "KEY_F2");
|
||||||
settings->setDefault("keymap_toggle_fog", "KEY_F3");
|
settings->setDefault("keymap_toggle_fog", "KEY_F3");
|
||||||
#if DEBUG
|
#ifndef NDEBUG
|
||||||
settings->setDefault("keymap_toggle_update_camera", "KEY_F4");
|
settings->setDefault("keymap_toggle_update_camera", "KEY_F4");
|
||||||
#else
|
#else
|
||||||
settings->setDefault("keymap_toggle_update_camera", "");
|
settings->setDefault("keymap_toggle_update_camera", "");
|
||||||
@ -174,8 +174,10 @@ void set_default_settings()
|
|||||||
// Visuals
|
// Visuals
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
settings->setDefault("show_debug", "false");
|
settings->setDefault("show_debug", "false");
|
||||||
|
settings->setDefault("opengl_debug", "false");
|
||||||
#else
|
#else
|
||||||
settings->setDefault("show_debug", "true");
|
settings->setDefault("show_debug", "true");
|
||||||
|
settings->setDefault("opengl_debug", "true");
|
||||||
#endif
|
#endif
|
||||||
settings->setDefault("fsaa", "2");
|
settings->setDefault("fsaa", "2");
|
||||||
settings->setDefault("undersampling", "1");
|
settings->setDefault("undersampling", "1");
|
||||||
|
Loading…
Reference in New Issue
Block a user