Browse Source

GL: implement --magnum-gpu-validation no-error.

I wonder if this actually makes any difference on any drivers.
euler-xxx
Vladimír Vondruš 5 years ago
parent
commit
45ccf50b47
  1. 6
      doc/changelog.dox
  2. 8
      src/Magnum/GL/Context.cpp
  3. 44
      src/Magnum/GL/Context.h
  4. 8
      src/Magnum/Platform/AbstractXApplication.h
  5. 8
      src/Magnum/Platform/AndroidApplication.h
  6. 8
      src/Magnum/Platform/EmscriptenApplication.h
  7. 4
      src/Magnum/Platform/GlfwApplication.cpp
  8. 15
      src/Magnum/Platform/GlfwApplication.h
  9. 4
      src/Magnum/Platform/Sdl2Application.cpp
  10. 15
      src/Magnum/Platform/Sdl2Application.h
  11. 8
      src/Magnum/Platform/WindowlessCglApplication.h
  12. 2
      src/Magnum/Platform/WindowlessEglApplication.cpp
  13. 15
      src/Magnum/Platform/WindowlessEglApplication.h
  14. 2
      src/Magnum/Platform/WindowlessGlxApplication.cpp
  15. 15
      src/Magnum/Platform/WindowlessGlxApplication.h
  16. 8
      src/Magnum/Platform/WindowlessIosApplication.h
  17. 2
      src/Magnum/Platform/WindowlessWglApplication.cpp
  18. 15
      src/Magnum/Platform/WindowlessWglApplication.h
  19. 2
      src/Magnum/Platform/WindowlessWindowsEglApplication.cpp
  20. 15
      src/Magnum/Platform/WindowlessWindowsEglApplication.h

6
doc/changelog.dox

@ -55,6 +55,12 @@ See also:
inherited by all @ref Platform::Sdl2Application::GLConfiguration "Platform::*Application::GLConfiguration" inherited by all @ref Platform::Sdl2Application::GLConfiguration "Platform::*Application::GLConfiguration"
and @ref Platform::WindowlessEglApplication::Configuration "Platform::Windowless*Application::Configuration" and @ref Platform::WindowlessEglApplication::Configuration "Platform::Windowless*Application::Configuration"
classes. 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 - Implemented @gl_extension{EXT,texture_norm16} and
@webgl_extension{EXT,texture_norm16} ES and WebGL extensions, making @webgl_extension{EXT,texture_norm16} ES and WebGL extensions, making
normalized 16-bit texture and renderbuffer formats available on all normalized 16-bit texture and renderbuffer formats available on all

8
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"); 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") 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("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") .addOption("log", "default").setHelp("log", "console logging", "default|quiet|verbose")
.setFromEnvironment("disable-workarounds") .setFromEnvironment("disable-workarounds")
.setFromEnvironment("disable-extensions") .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") else if(args.value("log") == "quiet" || args.value("log") == "QUIET")
_configurationFlags |= Configuration::Flag::QuietLog; _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") if(args.value("gpu-validation") == "on" || args.value("gpu-validation") == "ON")
_configurationFlags |= Configuration::Flag::GpuValidation; _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 /* If there are any disabled workarounds, save them until tryCreate() uses
them. The disableWorkaround() function saves the internal string view 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 */ /* GPU validation is enabled if either enables it */
if(configuration.flags() & Configuration::Flag::GpuValidation) if(configuration.flags() & Configuration::Flag::GpuValidation)
_configurationFlags |= Configuration::Flag::GpuValidation; _configurationFlags |= Configuration::Flag::GpuValidation;
if(configuration.flags() & Configuration::Flag::GpuValidationNoError)
_configurationFlags |= Configuration::Flag::GpuValidationNoError;
/* Same for windowless */ /* Same for windowless */
if(configuration.flags() & Configuration::Flag::Windowless) if(configuration.flags() & Configuration::Flag::Windowless)

44
src/Magnum/GL/Context.h

@ -70,10 +70,11 @@ namespace Implementation {
Context before the Configuration class is defined, it has to be here */ Context before the Configuration class is defined, it has to be here */
enum class ContextConfigurationFlag: UnsignedLong { enum class ContextConfigurationFlag: UnsignedLong {
/* Keeping the 32-bit range reserved for actual GL context flags */ /* Keeping the 32-bit range reserved for actual GL context flags */
Windowless = 1ull << 60, Windowless = 1ull << 59,
QuietLog = 1ull << 61, QuietLog = 1ull << 60,
VerboseLog = 1ull << 62, VerboseLog = 1ull << 61,
GpuValidation = 1ull << 63 GpuValidation = 1ull << 62,
GpuValidationNoError = 1ull << 63
}; };
typedef Containers::EnumSet<ContextConfigurationFlag> ContextConfigurationFlags; typedef Containers::EnumSet<ContextConfigurationFlag> ContextConfigurationFlags;
CORRADE_ENUMSET_OPERATORS(ContextConfigurationFlags) CORRADE_ENUMSET_OPERATORS(ContextConfigurationFlags)
@ -165,14 +166,15 @@ Arguments:
- `--magnum-disable-extensions LIST` --- API extensions to disable - `--magnum-disable-extensions LIST` --- API extensions to disable
(environment: `MAGNUM_DISABLE_EXTENSIONS`). Corresponds to (environment: `MAGNUM_DISABLE_EXTENSIONS`). Corresponds to
@ref Configuration::addDisabledExtensions(). @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: @gl_extension{KHR,debug}, if present (environment:
`MAGNUM_GPU_VALIDATION`) (default: `off`). This sets up @ref DebugOutput `MAGNUM_GPU_VALIDATION`) (default: `off`). This sets up @ref DebugOutput
callbacks and also causes callbacks and also causes
@ref Platform::Sdl2Application::GLConfiguration::Flag::Debug "GLConfiguration::Flag::Debug" @ref Platform::Sdl2Application::GLConfiguration::Flag::Debug "GLConfiguration::Flag::Debug"
to be enabled for context creation for both windowed and windowless to be enabled for context creation for both windowed and windowless
applications on supported platforms. Corresponds to 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 - `--magnum-log default|quiet|verbose` --- console logging
(environment: `MAGNUM_LOG`) (default: `default`). Corresponds to (environment: `MAGNUM_LOG`) (default: `default`). Corresponds to
@ref Configuration::Flag::QuietLog and @ref Configuration::Flag::QuietLog and
@ -234,9 +236,10 @@ class MAGNUM_GL_EXPORT Context {
/** /**
* Debug context. Enabled automatically by @ref Platform windowed * Debug context. Enabled automatically by @ref Platform windowed
* and windowless application implementations if the * and windowless application implementations if the
* @ref Configuration::Flag::GpuValidation flag is set or if the
* `--magnum-gpu-validation` * `--magnum-gpu-validation`
* @ref GL-Context-usage-command-line "command-line option" is * @ref GL-Context-usage-command-line "command-line option" is
* present. * set to `on`.
* @requires_gl43 Extension @gl_extension{KHR,debug} * @requires_gl43 Extension @gl_extension{KHR,debug}
* @requires_gles32 Extension @gl_extension{ANDROID,extension_pack_es31a} / * @requires_gles32 Extension @gl_extension{ANDROID,extension_pack_es31a} /
* @gl_extension{KHR,debug} * @gl_extension{KHR,debug}
@ -258,7 +261,12 @@ class MAGNUM_GL_EXPORT Context {
#endif #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_gl46 Extension @gl_extension{KHR,no_error}
* @requires_es_extension 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 * and, conversely, not possible to enable in any
* @ref Platform::Sdl2Application::GLConfiguration::Flag "Platform::*Application::GLConfiguration". * @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 * 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` * Corresponds to the `--magnum-log quiet`
* @ref GL-Context-usage-command-line "command-line option". * @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 * 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` * Corresponds to the `--magnum-log verbose`
* @ref GL-Context-usage-command-line "command-line option". * @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` * Corresponds to the `--magnum-gou-validation on`
* @ref GL-Context-usage-command-line "command-line option". * @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 #else
typedef Implementation::ContextConfigurationFlag Flag; typedef Implementation::ContextConfigurationFlag Flag;

8
src/Magnum/Platform/AbstractXApplication.h

@ -365,7 +365,13 @@ class AbstractXApplication::GLConfiguration: public GL::Context::Configuration {
* @copydoc GL::Context::Configuration::Flag::GpuValidation * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

8
src/Magnum/Platform/AndroidApplication.h

@ -478,7 +478,13 @@ class AndroidApplication::GLConfiguration: public GL::Context::Configuration {
* @copydoc GL::Context::Configuration::Flag::GpuValidation * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

8
src/Magnum/Platform/EmscriptenApplication.h

@ -1019,7 +1019,13 @@ class EmscriptenApplication::GLConfiguration: public GL::Context::Configuration
* @copydoc GL::Context::Configuration::Flag::GpuValidation * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

4
src/Magnum/Platform/GlfwApplication.cpp

@ -433,6 +433,10 @@ bool GlfwApplication::tryCreate(const Configuration& configuration, const GLConf
GLConfiguration::Flags glFlags = glConfiguration.flags(); GLConfiguration::Flags glFlags = glConfiguration.flags();
if((glFlags & GLConfiguration::Flag::GpuValidation) || (_context->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) if((glFlags & GLConfiguration::Flag::GpuValidation) || (_context->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation))
glFlags |= GLConfiguration::Flag::Debug; 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 #ifdef GLFW_CONTEXT_NO_ERROR
glfwWindowHint(GLFW_CONTEXT_NO_ERROR, glFlags >= GLConfiguration::Flag::NoError); glfwWindowHint(GLFW_CONTEXT_NO_ERROR, glFlags >= GLConfiguration::Flag::NoError);

15
src/Magnum/Platform/GlfwApplication.h

@ -804,7 +804,10 @@ class GlfwApplication::GLConfiguration: public GL::Context::Configuration {
/** /**
* Context without error reporting. Might result in better * Context without error reporting. Might result in better
* performance, but situations that would have generated errors * 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. * @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 * Debug context. Enabled automatically if supported by the driver
* and the @ref Flag::GpuValidation flag is set or if the * and the @ref Flag::GpuValidation flag is set or if the
* `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" * `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option"
* is present. * is set to `on`.
*/ */
Debug = 1 << 2, Debug = 1 << 2,
@ -837,7 +840,13 @@ class GlfwApplication::GLConfiguration: public GL::Context::Configuration {
* @copydoc GL::Context::Configuration::Flag::GpuValidation * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

4
src/Magnum/Platform/Sdl2Application.cpp

@ -469,6 +469,10 @@ bool Sdl2Application::tryCreate(const Configuration& configuration, const GLConf
GLConfiguration::Flags glFlags = glConfiguration.flags(); GLConfiguration::Flags glFlags = glConfiguration.flags();
if((glFlags & GLConfiguration::Flag::GpuValidation) || (_context->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) if((glFlags & GLConfiguration::Flag::GpuValidation) || (_context->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation))
glFlags |= GLConfiguration::Flag::Debug; 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 #if SDL_MAJOR_VERSION*1000 + SDL_MINOR_VERSION*100 + SDL_PATCHLEVEL >= 2006
SDL_GL_SetAttribute(SDL_GL_CONTEXT_NO_ERROR, glFlags >= GLConfiguration::Flag::NoError); SDL_GL_SetAttribute(SDL_GL_CONTEXT_NO_ERROR, glFlags >= GLConfiguration::Flag::NoError);

15
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 * Debug context. Enabled automatically if supported by the driver
* and the @ref Flag::GpuValidation flag is set or if the * and the @ref Flag::GpuValidation flag is set or if the
* `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" * `--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. * @requires_gles Context flags are not available in WebGL.
*/ */
Debug = SDL_GL_CONTEXT_DEBUG_FLAG, 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 * Context without error reporting. Might result in better
* performance, but situations that would have generated errors * 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. * @note Available since SDL 2.0.6.
* @requires_gles Context flags are not available in WebGL. * @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 * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

8
src/Magnum/Platform/WindowlessCglApplication.h

@ -188,7 +188,13 @@ class WindowlessCglContext::Configuration: public GL::Context::Configuration {
* @copydoc GL::Context::Configuration::Flag::GpuValidation * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

2
src/Magnum/Platform/WindowlessEglApplication.cpp

@ -312,6 +312,8 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G
Configuration::Flags flags = configuration.flags(); Configuration::Flags flags = configuration.flags();
if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation))
flags |= Configuration::Flag::Debug; flags |= Configuration::Flag::Debug;
else if((flags & Configuration::Flag::GpuValidationNoError) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidationNoError))
flags |= Configuration::Flag::NoError;
#endif #endif
/** @todo needs a growable DynamicArray with disabled alloc or somesuch */ /** @todo needs a growable DynamicArray with disabled alloc or somesuch */

15
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 * Debug context. Enabled automatically if supported by the driver
* and the @ref Flag::GpuValidation flag is set or if the * and the @ref Flag::GpuValidation flag is set or if the
* `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" * `--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. * @requires_gles Context flags are not available in WebGL.
*/ */
Debug = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, 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 * Context without error reporting. Might result in better
* performance, but situations that would have generated errors * 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. * @requires_gles Context flags are not available in WebGL.
* @m_since_latest * @m_since_latest
*/ */
@ -237,7 +240,13 @@ class WindowlessEglContext::Configuration: public GL::Context::Configuration {
* @copydoc GL::Context::Configuration::Flag::GpuValidation * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

2
src/Magnum/Platform/WindowlessGlxApplication.cpp

@ -116,6 +116,8 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
Configuration::Flags flags = configuration.flags(); Configuration::Flags flags = configuration.flags();
if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation))
flags |= Configuration::Flag::Debug; 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 */ /** @todo needs a growable DynamicArray with disabled alloc or somesuch */
/* Optimistically choose core context first */ /* Optimistically choose core context first */

15
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 * Debug context. Enabled automatically if supported by the driver
* and the @ref Flag::GpuValidation flag is set or if the * and the @ref Flag::GpuValidation flag is set or if the
* `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" * `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option"
* is present. * is set to `on`.
*/ */
Debug = GLX_CONTEXT_DEBUG_BIT_ARB, Debug = GLX_CONTEXT_DEBUG_BIT_ARB,
/** /**
* Context without error reporting. Might result in better * Context without error reporting. Might result in better
* performance, but situations that would have generated errors * 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 * @m_since_latest
*/ */
/* Treated as a separate attribute and not a flag in GLX, thus /* 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 * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

8
src/Magnum/Platform/WindowlessIosApplication.h

@ -179,7 +179,13 @@ class WindowlessIosContext::Configuration: public GL::Context::Configuration {
* @copydoc GL::Context::Configuration::Flag::GpuValidation * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

2
src/Magnum/Platform/WindowlessWglApplication.cpp

@ -129,6 +129,8 @@ WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, G
Configuration::Flags flags = configuration.flags(); Configuration::Flags flags = configuration.flags();
if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation))
flags |= Configuration::Flag::Debug; 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 */ /** @todo needs a growable DynamicArray with disabled alloc or somesuch */
/* Optimistically choose core context first */ /* Optimistically choose core context first */

15
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 * Debug context. Enabled automatically if supported by the driver
* and the @ref Flag::GpuValidation flag is set or if the * and the @ref Flag::GpuValidation flag is set or if the
* `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" * `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option"
* is present. * is set to `on`.
*/ */
Debug = WGL_CONTEXT_DEBUG_BIT_ARB, Debug = WGL_CONTEXT_DEBUG_BIT_ARB,
/** /**
* Context without error reporting. Might result in better * Context without error reporting. Might result in better
* performance, but situations that would have generated errors * 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 * @m_since_latest
*/ */
/* Treated as a separate attribute and not a flag in WGL, thus /* 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 * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

2
src/Magnum/Platform/WindowlessWindowsEglApplication.cpp

@ -121,6 +121,8 @@ WindowlessWindowsEglContext::WindowlessWindowsEglContext(const Configuration& co
Configuration::Flags flags = configuration.flags(); Configuration::Flags flags = configuration.flags();
if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation)) if((flags & Configuration::Flag::GpuValidation) || (magnumContext && magnumContext->configurationFlags() & GL::Context::Configuration::Flag::GpuValidation))
flags |= Configuration::Flag::Debug; 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 */ /** @todo needs a growable DynamicArray with disabled alloc or somesuch */
EGLint attributes[7] = { EGLint attributes[7] = {

15
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 * Debug context. Enabled automatically if supported by the driver
* and the @ref Flag::GpuValidation flag is set or if the * and the @ref Flag::GpuValidation flag is set or if the
* `--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" * `--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, Debug = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR,
/** /**
* Context without error reporting. Might result in better * Context without error reporting. Might result in better
* performance, but situations that would have generated errors * 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 * @m_since_latest
*/ */
/* Treated as a separate attribute and not a flag in EGL, thus /* 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 * @copydoc GL::Context::Configuration::Flag::GpuValidation
* @m_since_latest * @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)
}; };
/** /**

Loading…
Cancel
Save