Browse Source

Use privately Corrade Optional instead of the problematic std::optional.

Not in the public APIs yet (Trade etc.), as I need to solve backwards
compatibility first.
pull/225/head
Vladimír Vondruš 8 years ago
parent
commit
a97384839b
  1. 4
      src/Magnum/Context.h
  2. 2
      src/Magnum/Implementation/RendererState.cpp
  3. 4
      src/Magnum/Implementation/RendererState.h
  4. 2
      src/Magnum/PixelStorage.cpp
  5. 4
      src/Magnum/Shaders/MeshVisualizer.cpp

4
src/Magnum/Context.h

@ -34,12 +34,12 @@
#include <bitset>
#include <vector>
#include <Corrade/Containers/EnumSet.h>
#include <Corrade/Containers/Optional.h>
#include "Magnum/Magnum.h"
#include "Magnum/OpenGL.h"
#include "Magnum/Tags.h"
#include "Magnum/visibility.h"
#include "MagnumExternal/Optional/optional.hpp"
namespace Magnum {
@ -602,7 +602,7 @@ class MAGNUM_EXPORT Context {
Implementation::State* _state;
std::optional<DetectedDrivers> _detectedDrivers;
Containers::Optional<DetectedDrivers> _detectedDrivers;
/* True means known and disabled, false means known */
std::vector<std::pair<std::string, bool>> _driverWorkarounds;

2
src/Magnum/Implementation/RendererState.cpp

@ -105,7 +105,7 @@ RendererState::PixelStorage::PixelStorage():
void RendererState::PixelStorage::reset() {
#ifndef MAGNUM_TARGET_GLES
swapBytes = std::nullopt;
swapBytes = Containers::NullOpt;
#endif
alignment = DisengagedValue;
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))

4
src/Magnum/Implementation/RendererState.h

@ -27,10 +27,10 @@
#include <string>
#include <vector>
#include <Corrade/Containers/Optional.h>
#include "Magnum/Renderer.h"
#include "Magnum/Math/Vector3.h"
#include "MagnumExternal/Optional/optional.hpp"
namespace Magnum { namespace Implementation {
@ -52,7 +52,7 @@ struct RendererState {
void reset();
#ifndef MAGNUM_TARGET_GLES
std::optional<bool> swapBytes;
Containers::Optional<bool> swapBytes;
#endif
Int alignment;
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))

2
src/Magnum/PixelStorage.cpp

@ -220,7 +220,7 @@ void PixelStorage::applyInternal(const bool isUnpack) {
#ifndef MAGNUM_TARGET_GLES
/* Byte swap */
if(state.swapBytes == std::nullopt || state.swapBytes != _swapBytes)
if(state.swapBytes == Containers::NullOpt || state.swapBytes != _swapBytes)
glPixelStorei(isUnpack ? GL_UNPACK_SWAP_BYTES : GL_PACK_SWAP_BYTES,
*(state.swapBytes = _swapBytes));
#endif

4
src/Magnum/Shaders/MeshVisualizer.cpp

@ -25,12 +25,12 @@
#include "MeshVisualizer.h"
#include <Corrade/Containers/Optional.h>
#include <Corrade/Utility/Resource.h>
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Shader.h"
#include "MagnumExternal/Optional/optional.hpp"
#include "Implementation/CreateCompatibilityShader.h"
@ -86,7 +86,7 @@ MeshVisualizer::MeshVisualizer(const Flags flags): _flags{flags} {
.addSource(rs.get("MeshVisualizer.frag"));
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
std::optional<Shader> geom;
Containers::Optional<Shader> geom;
if(flags & Flag::Wireframe && !(flags & Flag::NoGeometryShader)) {
geom = Implementation::createCompatibilityShader(rs, version, Shader::Type::Geometry);
geom->addSource(rs.get("MeshVisualizer.geom"));

Loading…
Cancel
Save