Browse Source

GL: Context::InternalFlags as parameter in Context constructor

pull/494/head
Max Schwarz 5 years ago
parent
commit
e3a590b8a9
  1. 10
      src/Magnum/GL/Context.cpp
  2. 11
      src/Magnum/GL/Context.h

10
src/Magnum/GL/Context.cpp

@ -626,9 +626,9 @@ Context& Context::current() {
void Context::makeCurrent(Context* context) { currentContext = context; } void Context::makeCurrent(Context* context) { currentContext = context; }
Context::Context(NoCreateT, Int argc, const char** argv, void functionLoader(Context&)): Context{NoCreate, Utility::Arguments{"magnum"}, argc, argv, functionLoader} {} Context::Context(NoCreateT, Int argc, const char** argv, void functionLoader(Context&), InternalFlags flags): Context{NoCreate, Utility::Arguments{"magnum"}, argc, argv, functionLoader, flags} {}
Context::Context(NoCreateT, Utility::Arguments& args, Int argc, const char** argv, void functionLoader(Context&)): _functionLoader{functionLoader}, _version{Version::None} { Context::Context(NoCreateT, Utility::Arguments& args, Int argc, const char** argv, void functionLoader(Context&), InternalFlags flags): Context{NoCreate, functionLoader, flags} {
/* Parse arguments */ /* Parse arguments */
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")
@ -644,8 +644,8 @@ Context::Context(NoCreateT, Utility::Arguments& args, Int argc, const char** arg
/* Decide how to display initialization log */ /* Decide how to display initialization log */
if(args.value("log") == "verbose" || args.value("log") == "VERBOSE") if(args.value("log") == "verbose" || args.value("log") == "VERBOSE")
_internalFlags |= InternalFlag::DisplayVerboseInitializationLog; _internalFlags |= InternalFlag::DisplayVerboseInitializationLog;
else if(!(args.value("log") == "quiet" || args.value("log") == "QUIET")) else if(args.value("log") == "quiet" || args.value("log") == "QUIET")
_internalFlags |= InternalFlag::DisplayInitializationLog; _internalFlags &= ~InternalFlag::DisplayInitializationLog;
/* Decide whether to enable GPU validation */ /* Decide whether to enable GPU validation */
if(args.value("gpu-validation") == "on" || args.value("gpu-validation") == "ON") if(args.value("gpu-validation") == "on" || args.value("gpu-validation") == "ON")
@ -660,6 +660,8 @@ Context::Context(NoCreateT, Utility::Arguments& args, Int argc, const char** arg
_disabledExtensions.push_back(extension); _disabledExtensions.push_back(extension);
} }
Context::Context(NoCreateT, void functionLoader(Context&), InternalFlags flags): _functionLoader{functionLoader}, _version{Version::None}, _internalFlags{flags} {}
Context::Context(Context&& other) noexcept: _version{other._version}, Context::Context(Context&& other) noexcept: _version{other._version},
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
_flags{other._flags}, _flags{other._flags},

11
src/Magnum/GL/Context.h

@ -745,7 +745,9 @@ class MAGNUM_GL_EXPORT Context {
enum class InternalFlag: UnsignedByte { enum class InternalFlag: UnsignedByte {
DisplayInitializationLog = 1 << 0, DisplayInitializationLog = 1 << 0,
DisplayVerboseInitializationLog = DisplayInitializationLog|(1 << 1), DisplayVerboseInitializationLog = DisplayInitializationLog|(1 << 1),
GpuValidation = 1 << 2 GpuValidation = 1 << 2,
Default = DisplayInitializationLog
}; };
typedef Containers::EnumSet<InternalFlag> InternalFlags; typedef Containers::EnumSet<InternalFlag> InternalFlags;
CORRADE_ENUMSET_FRIEND_OPERATORS(InternalFlags) CORRADE_ENUMSET_FRIEND_OPERATORS(InternalFlags)
@ -766,9 +768,10 @@ class MAGNUM_GL_EXPORT Context {
#endif #endif
/* Made protected so it's possible to test the NoCreate constructor and /* Made protected so it's possible to test the NoCreate constructor and
also not needed to friend Platform::GLContext. */ also not needed to friend Platform::GLContext. */
explicit Context(NoCreateT, Int argc, const char** argv, void functionLoader(Context&)); explicit Context(NoCreateT, Int argc, const char** argv, void functionLoader(Context&), InternalFlags flags = InternalFlag::Default);
explicit Context(NoCreateT, Utility::Arguments&& args, Int argc, const char** argv, void functionLoader(Context&)): Context{NoCreate, args, argc, argv, functionLoader} {} explicit Context(NoCreateT, Utility::Arguments&& args, Int argc, const char** argv, void functionLoader(Context&), InternalFlags flags = InternalFlag::Default): Context{NoCreate, args, argc, argv, functionLoader, flags} {}
explicit Context(NoCreateT, Utility::Arguments& args, Int argc, const char** argv, void functionLoader(Context&)); explicit Context(NoCreateT, Utility::Arguments& args, Int argc, const char** argv, void functionLoader(Context&), InternalFlags flags = InternalFlag::Default);
explicit Context(NoCreateT, void functionLoader(Context&), InternalFlags flags = InternalFlag::Default);
bool tryCreate(); bool tryCreate();
void create(); void create();

Loading…
Cancel
Save