Browse Source

GL: use EnumSet instead of bool for internal flags.

There will be more soon.
pull/324/head
Vladimír Vondruš 7 years ago
parent
commit
4f2f29d1bb
  1. 5
      src/Magnum/GL/Context.cpp
  2. 9
      src/Magnum/GL/Context.h

5
src/Magnum/GL/Context.cpp

@ -464,7 +464,8 @@ Context::Context(NoCreateT, Utility::Arguments& args, Int argc, const char** arg
.parse(argc, argv); .parse(argc, argv);
/* Decide whether to display initialization log */ /* Decide whether to display initialization log */
_displayInitializationLog = !(args.value("log") == "quiet" || args.value("log") == "QUIET"); if(!(args.value("log") == "quiet" || args.value("log") == "QUIET"))
_internalFlags |= InternalFlag::DisplayInitializationLog;
/* Disable driver workarounds */ /* Disable driver workarounds */
for(auto&& workaround: Utility::String::splitWithoutEmptyParts(args.value("disable-workarounds"))) for(auto&& workaround: Utility::String::splitWithoutEmptyParts(args.value("disable-workarounds")))
@ -685,7 +686,7 @@ bool Context::tryCreate() {
currentContext = this; currentContext = this;
/* Decide whether to print the initialization output or not */ /* Decide whether to print the initialization output or not */
std::ostream* output = _displayInitializationLog ? Debug::output() : nullptr; std::ostream* output = _internalFlags & InternalFlag::DisplayInitializationLog ? Debug::output() : nullptr;
/* Print some info and initialize state tracker (which also prints some /* Print some info and initialize state tracker (which also prints some
more info) */ more info) */

9
src/Magnum/GL/Context.h

@ -667,6 +667,12 @@ class MAGNUM_GL_EXPORT Context {
friend Platform::GLContext; friend Platform::GLContext;
#endif #endif
enum class InternalFlag: UnsignedByte {
DisplayInitializationLog = 1 << 0
};
typedef Containers::EnumSet<InternalFlag> InternalFlags;
CORRADE_ENUMSET_FRIEND_OPERATORS(InternalFlags)
explicit Context(NoCreateT, Int argc, const char** argv, void functionLoader(Context&)); explicit Context(NoCreateT, Int argc, const char** argv, void functionLoader(Context&));
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&)): Context{NoCreate, args, argc, argv, functionLoader} {}
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&));
@ -700,7 +706,7 @@ class MAGNUM_GL_EXPORT Context {
/* True means known and disabled, false means known */ /* True means known and disabled, false means known */
std::vector<std::pair<std::string, bool>> _driverWorkarounds; std::vector<std::pair<std::string, bool>> _driverWorkarounds;
std::vector<std::string> _disabledExtensions; std::vector<std::string> _disabledExtensions;
bool _displayInitializationLog; InternalFlags _internalFlags;
}; };
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
@ -708,6 +714,7 @@ CORRADE_ENUMSET_OPERATORS(Context::Flags)
#endif #endif
CORRADE_ENUMSET_OPERATORS(Context::DetectedDrivers) CORRADE_ENUMSET_OPERATORS(Context::DetectedDrivers)
CORRADE_ENUMSET_OPERATORS(Context::States) CORRADE_ENUMSET_OPERATORS(Context::States)
CORRADE_ENUMSET_OPERATORS(Context::InternalFlags)
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
/** @debugoperatorclassenum{Context,Context::Flag} */ /** @debugoperatorclassenum{Context,Context::Flag} */

Loading…
Cancel
Save