From 45ccf50b4703e75b11529678b22bb79c5a948ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 1 Mar 2021 19:57:03 +0100 Subject: [PATCH] GL: implement --magnum-gpu-validation no-error. I wonder if this actually makes any difference on any drivers. --- doc/changelog.dox | 6 +++ src/Magnum/GL/Context.cpp | 8 +++- src/Magnum/GL/Context.h | 44 +++++++++++++------ src/Magnum/Platform/AbstractXApplication.h | 8 +++- src/Magnum/Platform/AndroidApplication.h | 8 +++- src/Magnum/Platform/EmscriptenApplication.h | 8 +++- src/Magnum/Platform/GlfwApplication.cpp | 4 ++ src/Magnum/Platform/GlfwApplication.h | 15 +++++-- src/Magnum/Platform/Sdl2Application.cpp | 4 ++ src/Magnum/Platform/Sdl2Application.h | 15 +++++-- .../Platform/WindowlessCglApplication.h | 8 +++- .../Platform/WindowlessEglApplication.cpp | 2 + .../Platform/WindowlessEglApplication.h | 15 +++++-- .../Platform/WindowlessGlxApplication.cpp | 2 + .../Platform/WindowlessGlxApplication.h | 15 +++++-- .../Platform/WindowlessIosApplication.h | 8 +++- .../Platform/WindowlessWglApplication.cpp | 2 + .../Platform/WindowlessWglApplication.h | 15 +++++-- .../WindowlessWindowsEglApplication.cpp | 2 + .../WindowlessWindowsEglApplication.h | 15 +++++-- 20 files changed, 166 insertions(+), 38 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 1db6285c2..9de2513ae 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -55,6 +55,12 @@ See also: inherited by all @ref Platform::Sdl2Application::GLConfiguration "Platform::*Application::GLConfiguration" and @ref Platform::WindowlessEglApplication::Configuration "Platform::Windowless*Application::Configuration" classes. +- The `--magnum-gpu-validation` option accepts a new value, `no-error`, which + creates OpenGL contexts without error reporting. Those may result in better + performance on certain drivers, however note that errors on such context + have undefined behavior and may cause stability issues. This option is also + programatically settable via a new + @ref GL::Context::Configuration::Flag::GpuValidationNoError flag. - Implemented @gl_extension{EXT,texture_norm16} and @webgl_extension{EXT,texture_norm16} ES and WebGL extensions, making normalized 16-bit texture and renderbuffer formats available on all diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index d1069ac8c..8d04b9a7d 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -693,7 +693,7 @@ Context::Context(NoCreateT, Utility::Arguments& args, Int argc, const char** arg CORRADE_INTERNAL_ASSERT(args.prefix() == "magnum"); args.addOption("disable-workarounds").setHelp("disable-workarounds", "driver workarounds to disable\n (see https://doc.magnum.graphics/magnum/opengl-workarounds.html for detailed info)", "LIST") .addOption("disable-extensions").setHelp("disable-extensions", "API extensions to disable", "LIST") - .addOption("gpu-validation", "off").setHelp("gpu-validation", "GPU validation using KHR_debug (if present)", "off|on") + .addOption("gpu-validation", "off").setHelp("gpu-validation", "GPU validation using KHR_debug (if present)", "off|on|no-error") .addOption("log", "default").setHelp("log", "console logging", "default|quiet|verbose") .setFromEnvironment("disable-workarounds") .setFromEnvironment("disable-extensions") @@ -707,9 +707,11 @@ Context::Context(NoCreateT, Utility::Arguments& args, Int argc, const char** arg else if(args.value("log") == "quiet" || args.value("log") == "QUIET") _configurationFlags |= Configuration::Flag::QuietLog; - /* Decide whether to enable GPU validation */ + /* Decide whether to enable GPU validation / no error context */ if(args.value("gpu-validation") == "on" || args.value("gpu-validation") == "ON") _configurationFlags |= Configuration::Flag::GpuValidation; + else if(args.value("gpu-validation") == "no-error") + _configurationFlags |= Configuration::Flag::GpuValidationNoError; /* If there are any disabled workarounds, save them until tryCreate() uses them. The disableWorkaround() function saves the internal string view @@ -784,6 +786,8 @@ bool Context::tryCreate(const Configuration& configuration) { /* GPU validation is enabled if either enables it */ if(configuration.flags() & Configuration::Flag::GpuValidation) _configurationFlags |= Configuration::Flag::GpuValidation; + if(configuration.flags() & Configuration::Flag::GpuValidationNoError) + _configurationFlags |= Configuration::Flag::GpuValidationNoError; /* Same for windowless */ if(configuration.flags() & Configuration::Flag::Windowless) diff --git a/src/Magnum/GL/Context.h b/src/Magnum/GL/Context.h index 86a6763ed..94d7a4337 100644 --- a/src/Magnum/GL/Context.h +++ b/src/Magnum/GL/Context.h @@ -70,10 +70,11 @@ namespace Implementation { Context before the Configuration class is defined, it has to be here */ enum class ContextConfigurationFlag: UnsignedLong { /* Keeping the 32-bit range reserved for actual GL context flags */ - Windowless = 1ull << 60, - QuietLog = 1ull << 61, - VerboseLog = 1ull << 62, - GpuValidation = 1ull << 63 + Windowless = 1ull << 59, + QuietLog = 1ull << 60, + VerboseLog = 1ull << 61, + GpuValidation = 1ull << 62, + GpuValidationNoError = 1ull << 63 }; typedef Containers::EnumSet ContextConfigurationFlags; CORRADE_ENUMSET_OPERATORS(ContextConfigurationFlags) @@ -165,14 +166,15 @@ Arguments: - `--magnum-disable-extensions LIST` --- API extensions to disable (environment: `MAGNUM_DISABLE_EXTENSIONS`). Corresponds to @ref Configuration::addDisabledExtensions(). -- `--magnum-gpu-validation off|on` --- GPU validation using +- `--magnum-gpu-validation off|on|no-error` --- GPU validation using @gl_extension{KHR,debug}, if present (environment: `MAGNUM_GPU_VALIDATION`) (default: `off`). This sets up @ref DebugOutput callbacks and also causes @ref Platform::Sdl2Application::GLConfiguration::Flag::Debug "GLConfiguration::Flag::Debug" to be enabled for context creation for both windowed and windowless applications on supported platforms. Corresponds to - @ref Configuration::Flag::GpuValidation. + @ref Configuration::Flag::GpuValidation / + @ref Configuration::Flag::GpuValidationNoError. - `--magnum-log default|quiet|verbose` --- console logging (environment: `MAGNUM_LOG`) (default: `default`). Corresponds to @ref Configuration::Flag::QuietLog and @@ -234,9 +236,10 @@ class MAGNUM_GL_EXPORT Context { /** * Debug context. Enabled automatically by @ref Platform windowed * and windowless application implementations if the + * @ref Configuration::Flag::GpuValidation flag is set or if the * `--magnum-gpu-validation` * @ref GL-Context-usage-command-line "command-line option" is - * present. + * set to `on`. * @requires_gl43 Extension @gl_extension{KHR,debug} * @requires_gles32 Extension @gl_extension{ANDROID,extension_pack_es31a} / * @gl_extension{KHR,debug} @@ -258,7 +261,12 @@ class MAGNUM_GL_EXPORT Context { #endif /** - * Context without error reporting + * Context without error reporting. Enabled automatically by + * @ref Platform windowed and windowless application + * implementations if the @ref Configuration::Flag::GpuValidationNoError + * flag is set or if the `--magnum-gpu-validation` + * @ref GL-Context-usage-command-line "command-line option" is + * set to `no-error`. * @requires_gl46 Extension @gl_extension{KHR,no_error} * @requires_es_extension Extension @gl_extension{KHR,no_error} */ @@ -926,7 +934,7 @@ class MAGNUM_GL_EXPORT Context::Configuration { * and, conversely, not possible to enable in any * @ref Platform::Sdl2Application::GLConfiguration::Flag "Platform::*Application::GLConfiguration". */ - Windowless = 1ull << 60, + Windowless = 1ull << 59, /** * Print only warnings and errors instead of the usual startup log @@ -936,7 +944,7 @@ class MAGNUM_GL_EXPORT Context::Configuration { * Corresponds to the `--magnum-log quiet` * @ref GL-Context-usage-command-line "command-line option". */ - QuietLog = 1ull << 61, + QuietLog = 1ull << 60, /** * Print additional information on startup in addition to the usual @@ -946,15 +954,25 @@ class MAGNUM_GL_EXPORT Context::Configuration { * Corresponds to the `--magnum-log verbose` * @ref GL-Context-usage-command-line "command-line option". */ - VerboseLog = 1ull << 62, + VerboseLog = 1ull << 61, /** - * Enable GPU validation, if available. + * Enable GPU validation, if available. Has a precedence over + * @ref Flag::GpuValidationNoError. * * Corresponds to the `--magnum-gou-validation on` * @ref GL-Context-usage-command-line "command-line option". */ - GpuValidation = 1ull << 63 + GpuValidation = 1ull << 62, + + /** + * Enable a context without error reporting, if available. Ignored + * if @ref Flag::GpuValidation is set. + * + * Corresponds to the `--magnum-gou-validation no-error` + * @ref GL-Context-usage-command-line "command-line option". + */ + GpuValidationNoError = 1ull << 63 }; #else typedef Implementation::ContextConfigurationFlag Flag; diff --git a/src/Magnum/Platform/AbstractXApplication.h b/src/Magnum/Platform/AbstractXApplication.h index 3b02f92f7..0291e3cc2 100644 --- a/src/Magnum/Platform/AbstractXApplication.h +++ b/src/Magnum/Platform/AbstractXApplication.h @@ -365,7 +365,13 @@ class AbstractXApplication::GLConfiguration: public GL::Context::Configuration { * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /** diff --git a/src/Magnum/Platform/AndroidApplication.h b/src/Magnum/Platform/AndroidApplication.h index 11ea3d620..7790a0662 100644 --- a/src/Magnum/Platform/AndroidApplication.h +++ b/src/Magnum/Platform/AndroidApplication.h @@ -478,7 +478,13 @@ class AndroidApplication::GLConfiguration: public GL::Context::Configuration { * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /** diff --git a/src/Magnum/Platform/EmscriptenApplication.h b/src/Magnum/Platform/EmscriptenApplication.h index fd76e5867..949355f56 100644 --- a/src/Magnum/Platform/EmscriptenApplication.h +++ b/src/Magnum/Platform/EmscriptenApplication.h @@ -1019,7 +1019,13 @@ class EmscriptenApplication::GLConfiguration: public GL::Context::Configuration * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /** diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index 1527651d2..70da60d79 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -433,6 +433,10 @@ bool GlfwApplication::tryCreate(const Configuration& configuration, const GLConf GLConfiguration::Flags glFlags = glConfiguration.flags(); if((glFlags & GLConfiguration::Flag::GpuValidation) || (_context->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) glFlags |= GLConfiguration::Flag::Debug; + #ifdef GLFW_CONTEXT_NO_ERROR + else if((glFlags & GLConfiguration::Flag::GpuValidationNoError) || (_context->configurationFlags() & GL::Context::Configuration::Flag::GpuValidationNoError)) + glFlags |= GLConfiguration::Flag::NoError; + #endif #ifdef GLFW_CONTEXT_NO_ERROR glfwWindowHint(GLFW_CONTEXT_NO_ERROR, glFlags >= GLConfiguration::Flag::NoError); diff --git a/src/Magnum/Platform/GlfwApplication.h b/src/Magnum/Platform/GlfwApplication.h index 327511c4c..c8f45615b 100644 --- a/src/Magnum/Platform/GlfwApplication.h +++ b/src/Magnum/Platform/GlfwApplication.h @@ -804,7 +804,10 @@ class GlfwApplication::GLConfiguration: public GL::Context::Configuration { /** * Context without error reporting. Might result in better * performance, but situations that would have generated errors - * instead cause undefined behavior. + * instead cause undefined behavior. Enabled automatically if + * supported by the driver and the @ref Flag::GpuValidationNoError + * flag is set or if the `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" + * is set to `no-error`. * * @note Supported since GLFW 3.2. */ @@ -815,7 +818,7 @@ class GlfwApplication::GLConfiguration: public GL::Context::Configuration { * Debug context. Enabled automatically if supported by the driver * and the @ref Flag::GpuValidation flag is set or if the * `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" - * is present. + * is set to `on`. */ Debug = 1 << 2, @@ -837,7 +840,13 @@ class GlfwApplication::GLConfiguration: public GL::Context::Configuration { * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /** diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 37dfbf47d..8a536e9e7 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -469,6 +469,10 @@ bool Sdl2Application::tryCreate(const Configuration& configuration, const GLConf GLConfiguration::Flags glFlags = glConfiguration.flags(); if((glFlags & GLConfiguration::Flag::GpuValidation) || (_context->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) glFlags |= GLConfiguration::Flag::Debug; + #if SDL_MAJOR_VERSION*1000 + SDL_MINOR_VERSION*100 + SDL_PATCHLEVEL >= 2006 + else if((glFlags & GLConfiguration::Flag::GpuValidationNoError) || (_context->configurationFlags() & GL::Context::Configuration::Flag::GpuValidationNoError)) + glFlags |= GLConfiguration::Flag::NoError; + #endif #if SDL_MAJOR_VERSION*1000 + SDL_MINOR_VERSION*100 + SDL_PATCHLEVEL >= 2006 SDL_GL_SetAttribute(SDL_GL_CONTEXT_NO_ERROR, glFlags >= GLConfiguration::Flag::NoError); diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index 34c8a53f5..23b0dd86d 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -1256,7 +1256,7 @@ class Sdl2Application::GLConfiguration: public GL::Context::Configuration { * Debug context. Enabled automatically if supported by the driver * and the @ref Flag::GpuValidation flag is set or if the * `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" - * is present. + * is set to `on`. * @requires_gles Context flags are not available in WebGL. */ Debug = SDL_GL_CONTEXT_DEBUG_FLAG, @@ -1277,7 +1277,10 @@ class Sdl2Application::GLConfiguration: public GL::Context::Configuration { /** * Context without error reporting. Might result in better * performance, but situations that would have generated errors - * instead cause undefined behavior. + * instead cause undefined behavior. Enabled automatically if + * supported by the driver and the @ref Flag::GpuValidationNoError + * flag is set or if the `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" + * is set to `no-error`. * * @note Available since SDL 2.0.6. * @requires_gles Context flags are not available in WebGL. @@ -1305,7 +1308,13 @@ class Sdl2Application::GLConfiguration: public GL::Context::Configuration { * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /** diff --git a/src/Magnum/Platform/WindowlessCglApplication.h b/src/Magnum/Platform/WindowlessCglApplication.h index ecb3dc915..0d76c5841 100644 --- a/src/Magnum/Platform/WindowlessCglApplication.h +++ b/src/Magnum/Platform/WindowlessCglApplication.h @@ -188,7 +188,13 @@ class WindowlessCglContext::Configuration: public GL::Context::Configuration { * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /** diff --git a/src/Magnum/Platform/WindowlessEglApplication.cpp b/src/Magnum/Platform/WindowlessEglApplication.cpp index 19140d96e..89fa13406 100644 --- a/src/Magnum/Platform/WindowlessEglApplication.cpp +++ b/src/Magnum/Platform/WindowlessEglApplication.cpp @@ -312,6 +312,8 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G Configuration::Flags flags = configuration.flags(); if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) flags |= Configuration::Flag::Debug; + else if((flags & Configuration::Flag::GpuValidationNoError) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidationNoError)) + flags |= Configuration::Flag::NoError; #endif /** @todo needs a growable DynamicArray with disabled alloc or somesuch */ diff --git a/src/Magnum/Platform/WindowlessEglApplication.h b/src/Magnum/Platform/WindowlessEglApplication.h index afd1e3133..7aa6d7888 100644 --- a/src/Magnum/Platform/WindowlessEglApplication.h +++ b/src/Magnum/Platform/WindowlessEglApplication.h @@ -204,7 +204,7 @@ class WindowlessEglContext::Configuration: public GL::Context::Configuration { * Debug context. Enabled automatically if supported by the driver * and the @ref Flag::GpuValidation flag is set or if the * `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" - * is present. + * is set to `on`. * @requires_gles Context flags are not available in WebGL. */ Debug = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, @@ -212,7 +212,10 @@ class WindowlessEglContext::Configuration: public GL::Context::Configuration { /** * Context without error reporting. Might result in better * performance, but situations that would have generated errors - * instead cause undefined behavior. + * instead cause undefined behavior. Enabled automatically if + * supported by the driver and the @ref Flag::GpuValidationNoError + * flag is set or if the `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" + * is set to `no-error`. * @requires_gles Context flags are not available in WebGL. * @m_since_latest */ @@ -237,7 +240,13 @@ class WindowlessEglContext::Configuration: public GL::Context::Configuration { * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /** diff --git a/src/Magnum/Platform/WindowlessGlxApplication.cpp b/src/Magnum/Platform/WindowlessGlxApplication.cpp index cfeb65a74..ed0d2d80e 100644 --- a/src/Magnum/Platform/WindowlessGlxApplication.cpp +++ b/src/Magnum/Platform/WindowlessGlxApplication.cpp @@ -116,6 +116,8 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura Configuration::Flags flags = configuration.flags(); if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) flags |= Configuration::Flag::Debug; + else if((flags & Configuration::Flag::GpuValidationNoError) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidationNoError)) + flags |= Configuration::Flag::NoError; /** @todo needs a growable DynamicArray with disabled alloc or somesuch */ /* Optimistically choose core context first */ diff --git a/src/Magnum/Platform/WindowlessGlxApplication.h b/src/Magnum/Platform/WindowlessGlxApplication.h index d8fd54874..f549f7d1f 100644 --- a/src/Magnum/Platform/WindowlessGlxApplication.h +++ b/src/Magnum/Platform/WindowlessGlxApplication.h @@ -208,14 +208,17 @@ class WindowlessGlxContext::Configuration: public GL::Context::Configuration { * Debug context. Enabled automatically if supported by the driver * and the @ref Flag::GpuValidation flag is set or if the * `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" - * is present. + * is set to `on`. */ Debug = GLX_CONTEXT_DEBUG_BIT_ARB, /** * Context without error reporting. Might result in better * performance, but situations that would have generated errors - * instead cause undefined behavior. + * instead cause undefined behavior. Enabled automatically if + * supported by the driver and the @ref Flag::GpuValidationNoError + * flag is set or if the `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" + * is set to `no-error`. * @m_since_latest */ /* Treated as a separate attribute and not a flag in GLX, thus @@ -238,7 +241,13 @@ class WindowlessGlxContext::Configuration: public GL::Context::Configuration { * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /** diff --git a/src/Magnum/Platform/WindowlessIosApplication.h b/src/Magnum/Platform/WindowlessIosApplication.h index 5b55b2643..5932a13b4 100644 --- a/src/Magnum/Platform/WindowlessIosApplication.h +++ b/src/Magnum/Platform/WindowlessIosApplication.h @@ -179,7 +179,13 @@ class WindowlessIosContext::Configuration: public GL::Context::Configuration { * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /** diff --git a/src/Magnum/Platform/WindowlessWglApplication.cpp b/src/Magnum/Platform/WindowlessWglApplication.cpp index da9466547..760c1dcd6 100644 --- a/src/Magnum/Platform/WindowlessWglApplication.cpp +++ b/src/Magnum/Platform/WindowlessWglApplication.cpp @@ -129,6 +129,8 @@ WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, G Configuration::Flags flags = configuration.flags(); if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) flags |= Configuration::Flag::Debug; + else if((flags & Configuration::Flag::GpuValidationNoError) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidationNoError)) + flags |= Configuration::Flag::NoError; /** @todo needs a growable DynamicArray with disabled alloc or somesuch */ /* Optimistically choose core context first */ diff --git a/src/Magnum/Platform/WindowlessWglApplication.h b/src/Magnum/Platform/WindowlessWglApplication.h index d33436358..923b51514 100644 --- a/src/Magnum/Platform/WindowlessWglApplication.h +++ b/src/Magnum/Platform/WindowlessWglApplication.h @@ -195,14 +195,17 @@ class WindowlessWglContext::Configuration: public GL::Context::Configuration { * Debug context. Enabled automatically if supported by the driver * and the @ref Flag::GpuValidation flag is set or if the * `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" - * is present. + * is set to `on`. */ Debug = WGL_CONTEXT_DEBUG_BIT_ARB, /** * Context without error reporting. Might result in better * performance, but situations that would have generated errors - * instead cause undefined behavior. + * instead cause undefined behavior. Enabled automatically if + * supported by the driver and the @ref Flag::GpuValidationNoError + * flag is set or if the `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" + * is set to `no-error`. * @m_since_latest */ /* Treated as a separate attribute and not a flag in WGL, thus @@ -225,7 +228,13 @@ class WindowlessWglContext::Configuration: public GL::Context::Configuration { * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /** diff --git a/src/Magnum/Platform/WindowlessWindowsEglApplication.cpp b/src/Magnum/Platform/WindowlessWindowsEglApplication.cpp index 182656214..c959bdbfc 100644 --- a/src/Magnum/Platform/WindowlessWindowsEglApplication.cpp +++ b/src/Magnum/Platform/WindowlessWindowsEglApplication.cpp @@ -121,6 +121,8 @@ WindowlessWindowsEglContext::WindowlessWindowsEglContext(const Configuration& co Configuration::Flags flags = configuration.flags(); if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) flags |= Configuration::Flag::Debug; + else if((flags & Configuration::Flag::GpuValidationNoError) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidationNoError)) + flags |= Configuration::Flag::NoError; /** @todo needs a growable DynamicArray with disabled alloc or somesuch */ EGLint attributes[7] = { diff --git a/src/Magnum/Platform/WindowlessWindowsEglApplication.h b/src/Magnum/Platform/WindowlessWindowsEglApplication.h index 836b419b1..e0a6df5f8 100644 --- a/src/Magnum/Platform/WindowlessWindowsEglApplication.h +++ b/src/Magnum/Platform/WindowlessWindowsEglApplication.h @@ -171,14 +171,17 @@ class WindowlessWindowsEglContext::Configuration: public GL::Context::Configurat * Debug context. Enabled automatically if supported by the driver * and the @ref Flag::GpuValidation flag is set or if the * `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" - * is present. + * is set to `on`. */ Debug = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, /** * Context without error reporting. Might result in better * performance, but situations that would have generated errors - * instead cause undefined behavior. + * instead cause undefined behavior. Enabled automatically if + * supported by the driver and the @ref Flag::GpuValidationNoError + * flag is set or if the `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" + * is set to `no-error`. * @m_since_latest */ /* Treated as a separate attribute and not a flag in EGL, thus @@ -201,7 +204,13 @@ class WindowlessWindowsEglContext::Configuration: public GL::Context::Configurat * @copydoc GL::Context::Configuration::Flag::GpuValidation * @m_since_latest */ - GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) + GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation), + + /** + * @copydoc GL::Context::Configuration::Flag::GpuValidationNoError + * @m_since_latest + */ + GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) }; /**