Browse Source

GL: don't implicitly enable debug output in OpenGLTester.

It's just too spammy and we have a nice opt-in way now, so direct users to
use that instead.
pull/368/head
Vladimír Vondruš 7 years ago
parent
commit
acf06eb6d8
  1. 5
      doc/changelog.dox
  2. 23
      src/Magnum/GL/OpenGLTester.cpp
  3. 24
      src/Magnum/GL/OpenGLTester.h
  4. 13
      src/Magnum/GL/Test/DebugOutputGLTest.cpp

5
doc/changelog.dox

@ -308,6 +308,11 @@ See also:
from flags passed to `eglCreateContext()` as that otherwise causes NVidia from flags passed to `eglCreateContext()` as that otherwise causes NVidia
to fail with `EGL_BAD_MATCH`. See @ref opengl-workarounds for more to fail with `EGL_BAD_MATCH`. See @ref opengl-workarounds for more
information. information.
- @ref GL::OpenGLTester no longer implicitly enables @ref GL::DebugOutput as
it can be quite spammy when complex shaders or benchmarks are allowed. For
easier debugging, users are encouraged to use the new
`--magnum-gpu-validation` @ref GL-Context-command-line "command line option"
instead.
@subsubsection changelog-latest-changes-math Math library @subsubsection changelog-latest-changes-math Math library

23
src/Magnum/GL/OpenGLTester.cpp

@ -35,28 +35,7 @@
namespace Magnum { namespace GL { namespace Magnum { namespace GL {
OpenGLTester::OpenGLTester(): TestSuite::Tester{TestSuite::Tester::TesterConfiguration{}.setSkippedArgumentPrefixes({"magnum"})}, _windowlessApplication{{arguments().first, arguments().second}} { OpenGLTester::OpenGLTester(): TestSuite::Tester{TestSuite::Tester::TesterConfiguration{}.setSkippedArgumentPrefixes({"magnum"})}, _windowlessApplication{{arguments().first, arguments().second}} {}
/* Try to create debug context, fallback to normal one if not possible. No
such thing on macOS, iOS or WebGL. */
#if !defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_WEBGL)
if(!_windowlessApplication.tryCreateContext(Platform::WindowlessApplication::Configuration{}.addFlags(Platform::WindowlessApplication::Configuration::Flag::Debug)))
_windowlessApplication.createContext();
#else
_windowlessApplication.createContext();
#endif
#ifndef MAGNUM_TARGET_WEBGL
if(Context::current().isExtensionSupported<Extensions::KHR::debug>()) {
Renderer::enable(Renderer::Feature::DebugOutput);
Renderer::enable(Renderer::Feature::DebugOutputSynchronous);
DebugOutput::setDefaultCallback();
/* Disable "Buffer detailed info" message on NV (too spammy) */
if(Context::current().detectedDriver() & Context::DetectedDriver::NVidia)
DebugOutput::setEnabled(DebugOutput::Source::Api, DebugOutput::Type::Other, {131185}, false);
}
#endif
}
OpenGLTester::~OpenGLTester() = default; OpenGLTester::~OpenGLTester() = default;

24
src/Magnum/GL/OpenGLTester.h

@ -121,16 +121,14 @@ to run single isolated test cases.
@section GL-OpenGLTester-debug Debug context and error checking @section GL-OpenGLTester-debug Debug context and error checking
On platforms that support it, the OpenGL context is created with synchronous Because @ref DebugOutput can be quite spammy in some cases, especially when
debug output, meaning that every OpenGL error is directly reported to standard compiling more complex shaders or doing benchmarks, it's not implicitly enabled
output. While it is possible, the tester class doesn't abort the test cases by default to make the test output more readable. Instead of relying on debug
upon encountering a GL error --- this should be done explicitly with output to report errors, the @ref MAGNUM_VERIFY_NO_GL_ERROR() macro should be
@ref MAGNUM_VERIFY_NO_GL_ERROR() instead, as the debug output is not available used to reliably check for errors regardless of platform support. For easier
on all platforms and not all GL errors are fatal. debugging of OpenGL errors users are encuraged to use the
`--magnum-gpu-validation` @ref GL-Context-command-line "command line option",
@note This overrides the `--magnum-gpu-validation` which is supported here as well as in all other application implementations.
@ref GL-Context-command-line "command line option", making it always
enabled.
@section GL-OpenGLTester-benchmarks GPU time benchmarks @section GL-OpenGLTester-benchmarks GPU time benchmarks
@ -263,12 +261,8 @@ class OpenGLTester: public TestSuite::Tester {
#endif #endif
struct WindowlessApplication: Platform::WindowlessApplication { struct WindowlessApplication: Platform::WindowlessApplication {
explicit WindowlessApplication(const Arguments& arguments): Platform::WindowlessApplication{arguments, NoCreate} {} explicit WindowlessApplication(const Arguments& arguments): Platform::WindowlessApplication{arguments} {}
int exec() override final { return 0; } int exec() override final { return 0; }
using Platform::WindowlessApplication::tryCreateContext;
using Platform::WindowlessApplication::createContext;
} _windowlessApplication; } _windowlessApplication;
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL

13
src/Magnum/GL/Test/DebugOutputGLTest.cpp

@ -73,7 +73,6 @@ void DebugOutputGLTest::setCallbackDefault() {
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>()) if(!Context::current().isExtensionSupported<Extensions::KHR::debug>())
CORRADE_SKIP(Extensions::KHR::debug::string() + std::string(" is not supported")); CORRADE_SKIP(Extensions::KHR::debug::string() + std::string(" is not supported"));
/* Need to be careful, because the test runner is using debug output too */
DebugOutput::setDefaultCallback(); DebugOutput::setDefaultCallback();
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
@ -82,14 +81,22 @@ void DebugOutputGLTest::setCallbackDefault() {
void DebugOutputGLTest::setup() { void DebugOutputGLTest::setup() {
_out.str({}); _out.str({});
if(Context::current().isExtensionSupported<Extensions::KHR::debug>()) if(!Context::current().isExtensionSupported<Extensions::KHR::debug>())
return;
Renderer::enable(Renderer::Feature::DebugOutput);
Renderer::enable(Renderer::Feature::DebugOutputSynchronous);
DebugOutput::setCallback([](DebugOutput::Source source, DebugOutput::Type type, UnsignedInt id, DebugOutput::Severity severity, const std::string& string, const void* userPtr) { DebugOutput::setCallback([](DebugOutput::Source source, DebugOutput::Type type, UnsignedInt id, DebugOutput::Severity severity, const std::string& string, const void* userPtr) {
Implementation::defaultDebugCallback(source, type, id, severity, string, static_cast<std::ostringstream*>(const_cast<void*>(userPtr))); Implementation::defaultDebugCallback(source, type, id, severity, string, static_cast<std::ostringstream*>(const_cast<void*>(userPtr)));
}, &_out); }, &_out);
} }
void DebugOutputGLTest::teardown() { void DebugOutputGLTest::teardown() {
if(Context::current().isExtensionSupported<Extensions::KHR::debug>()) if(!Context::current().isExtensionSupported<Extensions::KHR::debug>())
return;
Renderer::disable(Renderer::Feature::DebugOutput);
Renderer::disable(Renderer::Feature::DebugOutputSynchronous);
DebugOutput::setDefaultCallback(); DebugOutput::setDefaultCallback();
} }

Loading…
Cancel
Save