Browse Source

GL: ... and neither Optional has to be in Context.h.

All that work to reduce header dependencies and yet here it's full of
them, somehow.

Well, given the fallout in various GL tests now I wonder if I should
just chuck the rest along with the state allocation as a PIMPL.
next
Vladimír Vondruš 2 months ago
parent
commit
c4b1594d9d
  1. 4
      src/Magnum/GL/Context.h
  2. 29
      src/Magnum/GL/Implementation/driverSpecific.cpp
  3. 1
      src/Magnum/GL/Shader.cpp
  4. 1
      src/Magnum/GL/Test/ContextGLTest.cpp
  5. 1
      src/Magnum/GL/Test/RendererGLTest.cpp
  6. 1
      src/Magnum/MeshTools/Test/CompileGLTest.cpp
  7. 1
      src/Magnum/Shaders/MeshVisualizerGL.cpp
  8. 1
      src/Magnum/Shaders/Test/LineGLTest.cpp
  9. 1
      src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp
  10. 1
      src/Magnum/Shaders/Test/VertexColorGLTest.cpp
  11. 1
      src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp
  12. 1
      src/Magnum/TextureTools/Test/DistanceFieldGLBenchmark.cpp
  13. 1
      src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp
  14. 1
      src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp

4
src/Magnum/GL/Context.h

@ -34,7 +34,6 @@
#include <Corrade/Containers/Array.h> #include <Corrade/Containers/Array.h>
#include <Corrade/Containers/ArrayTuple.h> #include <Corrade/Containers/ArrayTuple.h>
#include <Corrade/Containers/EnumSet.h> #include <Corrade/Containers/EnumSet.h>
#include <Corrade/Containers/Optional.h>
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/Math/BitVector.h" #include "Magnum/Math/BitVector.h"
@ -928,7 +927,8 @@ class MAGNUM_GL_EXPORT Context {
Containers::ArrayTuple _stateData; Containers::ArrayTuple _stateData;
Implementation::State* _state; Implementation::State* _state;
Containers::Optional<DetectedDrivers> _detectedDrivers; /* ~DetectedDrivers{} means the value is not initialized yet */
DetectedDrivers _detectedDrivers = ~DetectedDrivers{};
/** @todo these are all needed only until the state gets created and /** @todo these are all needed only until the state gets created and
then can be discarded -- what to do? we could avoid including then can be discarded -- what to do? we could avoid including

29
src/Magnum/GL/Implementation/driverSpecific.cpp

@ -527,8 +527,9 @@ Containers::StringView findWorkaround(Containers::StringView workaround) {
} }
auto Context::detectedDriver() -> DetectedDrivers { auto Context::detectedDriver() -> DetectedDrivers {
if(_detectedDrivers) /* ~DetectedDrivers{} means the value is not initialized yet */
return *_detectedDrivers; if(_detectedDrivers != ~DetectedDrivers{})
return _detectedDrivers;
_detectedDrivers = DetectedDrivers{}; _detectedDrivers = DetectedDrivers{};
@ -563,12 +564,12 @@ auto Context::detectedDriver() -> DetectedDrivers {
#ifndef CORRADE_TARGET_APPLE #ifndef CORRADE_TARGET_APPLE
/* AMD binary desktop drivers */ /* AMD binary desktop drivers */
if(vendor.contains("ATI Technologies Inc."_s)) if(vendor.contains("ATI Technologies Inc."_s))
*_detectedDrivers |= DetectedDriver::Amd; _detectedDrivers |= DetectedDriver::Amd;
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
/* Intel Windows drivers */ /* Intel Windows drivers */
if(vendor.contains("Intel"_s)) if(vendor.contains("Intel"_s))
*_detectedDrivers |= DetectedDriver::IntelWindows; _detectedDrivers |= DetectedDriver::IntelWindows;
#endif #endif
/* Mesa drivers. /* Mesa drivers.
@ -587,21 +588,21 @@ auto Context::detectedDriver() -> DetectedDrivers {
|| version.contains("Mesa"_s) || version.contains("Mesa"_s)
#endif #endif
) { ) {
*_detectedDrivers |= DetectedDriver::Mesa; _detectedDrivers |= DetectedDriver::Mesa;
if(renderer.contains("SVGA3D"_s)) if(renderer.contains("SVGA3D"_s))
*_detectedDrivers |= DetectedDriver::Svga3D; _detectedDrivers |= DetectedDriver::Svga3D;
} }
if(vendor.contains("NVIDIA Corporation"_s)) if(vendor.contains("NVIDIA Corporation"_s))
*_detectedDrivers |= DetectedDriver::NVidia; _detectedDrivers |= DetectedDriver::NVidia;
#endif #endif
#ifdef MAGNUM_TARGET_GLES #ifdef MAGNUM_TARGET_GLES
/* ANGLE. On WebGL only if we are so lucky and have access to the unmasked /* ANGLE. On WebGL only if we are so lucky and have access to the unmasked
renderer string. */ renderer string. */
if(renderer.contains("ANGLE"_s)) if(renderer.contains("ANGLE"_s))
*_detectedDrivers |= DetectedDriver::Angle; _detectedDrivers |= DetectedDriver::Angle;
#ifdef MAGNUM_TARGET_WEBGL #ifdef MAGNUM_TARGET_WEBGL
/* If the unmasked renderer string is not available, try other means */ /* If the unmasked renderer string is not available, try other means */
/** @todo this (and below) incorrectly detects ANGLE on FF 92+, as it has /** @todo this (and below) incorrectly detects ANGLE on FF 92+, as it has
@ -620,7 +621,7 @@ auto Context::detectedDriver() -> DetectedDrivers {
#else #else
if(isExtensionSupported<Extensions::WEBGL::multi_draw>()) if(isExtensionSupported<Extensions::WEBGL::multi_draw>())
#endif #endif
*_detectedDrivers |= DetectedDriver::Angle; _detectedDrivers |= DetectedDriver::Angle;
/* Otherwise try to detect a D3D ANGLE backend by querying line width. /* Otherwise try to detect a D3D ANGLE backend by querying line width.
It's always exactly just 1 on D3D, usually (but not always) more on It's always exactly just 1 on D3D, usually (but not always) more on
GL, not sure about Metal. So this is not a 100% match. Sources: GL, not sure about Metal. So this is not a 100% match. Sources:
@ -629,7 +630,7 @@ auto Context::detectedDriver() -> DetectedDrivers {
Range1Di range; Range1Di range;
glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range.data()); glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range.data());
if(range.min() == 1 && range.max() == 1 && vendor != "Internet Explorer"_s) { if(range.min() == 1 && range.max() == 1 && vendor != "Internet Explorer"_s) {
*_detectedDrivers |= DetectedDriver::Angle; _detectedDrivers |= DetectedDriver::Angle;
} }
} }
} }
@ -637,20 +638,20 @@ auto Context::detectedDriver() -> DetectedDrivers {
/* SwiftShader */ /* SwiftShader */
if(renderer.contains("SwiftShader"_s)) if(renderer.contains("SwiftShader"_s))
*_detectedDrivers |= DetectedDriver::SwiftShader; _detectedDrivers |= DetectedDriver::SwiftShader;
#endif #endif
#ifdef CORRADE_TARGET_ANDROID #ifdef CORRADE_TARGET_ANDROID
if(vendor.contains("ARM"_s) && renderer.contains("Mali"_s)) if(vendor.contains("ARM"_s) && renderer.contains("Mali"_s))
*_detectedDrivers |= DetectedDriver::ArmMali; _detectedDrivers |= DetectedDriver::ArmMali;
#endif #endif
#if defined(MAGNUM_TARGET_GLES) && !defined(CORRADE_TARGET_APPLE) #if defined(MAGNUM_TARGET_GLES) && !defined(CORRADE_TARGET_APPLE)
if(vendor.contains("Qualcomm"_s) && renderer.contains("Adreno"_s)) if(vendor.contains("Qualcomm"_s) && renderer.contains("Adreno"_s))
*_detectedDrivers |= DetectedDriver::QualcommAdreno; _detectedDrivers |= DetectedDriver::QualcommAdreno;
#endif #endif
return *_detectedDrivers; return _detectedDrivers;
} }
void Context::disableDriverWorkaround(const Containers::StringView workaround) { void Context::disableDriverWorkaround(const Containers::StringView workaround) {

1
src/Magnum/GL/Shader.cpp

@ -29,6 +29,7 @@
#include <Corrade/Containers/Array.h> #include <Corrade/Containers/Array.h>
#include <Corrade/Containers/GrowableArray.h> #include <Corrade/Containers/GrowableArray.h>
#include <Corrade/Containers/Optional.h>
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
#include <Corrade/Containers/Reference.h> #include <Corrade/Containers/Reference.h>
#endif #endif

1
src/Magnum/GL/Test/ContextGLTest.cpp

@ -25,6 +25,7 @@
*/ */
#include <algorithm> /* std::find() */ #include <algorithm> /* std::find() */
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/ScopeGuard.h> #include <Corrade/Containers/ScopeGuard.h>
#include <Corrade/Containers/StringIterable.h> #include <Corrade/Containers/StringIterable.h>
#include <Corrade/Containers/StringStl.h> /** @todo remove once Debug is stream-free */ #include <Corrade/Containers/StringStl.h> /** @todo remove once Debug is stream-free */

1
src/Magnum/GL/Test/RendererGLTest.cpp

@ -31,6 +31,7 @@
#include <Corrade/Utility/Path.h> #include <Corrade/Utility/Path.h>
#ifdef CORRADE_TARGET_APPLE #ifdef CORRADE_TARGET_APPLE
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/Pair.h> #include <Corrade/Containers/Pair.h>
#include <Corrade/Utility/System.h> /* isSandboxed() */ #include <Corrade/Utility/System.h> /* isSandboxed() */
#endif #endif

1
src/Magnum/MeshTools/Test/CompileGLTest.cpp

@ -27,6 +27,7 @@
#include <Corrade/Containers/EnumSet.h> #include <Corrade/Containers/EnumSet.h>
#include <Corrade/Containers/GrowableArray.h> #include <Corrade/Containers/GrowableArray.h>
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/Pair.h> #include <Corrade/Containers/Pair.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/Containers/StringIterable.h> #include <Corrade/Containers/StringIterable.h>

1
src/Magnum/Shaders/MeshVisualizerGL.cpp

@ -29,6 +29,7 @@
#include <Corrade/Containers/EnumSet.hpp> #include <Corrade/Containers/EnumSet.hpp>
#include <Corrade/Containers/Iterable.h> #include <Corrade/Containers/Iterable.h>
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include <Corrade/Utility/Resource.h> #include <Corrade/Utility/Resource.h>

1
src/Magnum/Shaders/Test/LineGLTest.cpp

@ -26,6 +26,7 @@
#include <Corrade/Containers/GrowableArray.h> #include <Corrade/Containers/GrowableArray.h>
#include <Corrade/Containers/Iterable.h> #include <Corrade/Containers/Iterable.h>
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StridedArrayView.h> #include <Corrade/Containers/StridedArrayView.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/Containers/StringIterable.h> #include <Corrade/Containers/StringIterable.h>

1
src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp

@ -27,6 +27,7 @@
#include <numeric> /* std::iota() */ #include <numeric> /* std::iota() */
#include <Corrade/Containers/ArrayViewStl.h> #include <Corrade/Containers/ArrayViewStl.h>
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/Pair.h> #include <Corrade/Containers/Pair.h>
#include <Corrade/Containers/StridedArrayView.h> #include <Corrade/Containers/StridedArrayView.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>

1
src/Magnum/Shaders/Test/VertexColorGLTest.cpp

@ -25,6 +25,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/Pair.h> #include <Corrade/Containers/Pair.h>
#include <Corrade/Containers/StridedArrayView.h> #include <Corrade/Containers/StridedArrayView.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>

1
src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp

@ -24,6 +24,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StridedArrayView.h> #include <Corrade/Containers/StridedArrayView.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/PluginManager/AbstractManager.h> #include <Corrade/PluginManager/AbstractManager.h>

1
src/Magnum/TextureTools/Test/DistanceFieldGLBenchmark.cpp

@ -24,6 +24,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/PluginManager/AbstractManager.h> #include <Corrade/PluginManager/AbstractManager.h>
#include <Corrade/Utility/Path.h> #include <Corrade/Utility/Path.h>

1
src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp

@ -24,6 +24,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StridedArrayView.h> #include <Corrade/Containers/StridedArrayView.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/PluginManager/AbstractManager.h> #include <Corrade/PluginManager/AbstractManager.h>

1
src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp

@ -24,6 +24,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StridedArrayView.h> #include <Corrade/Containers/StridedArrayView.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/Containers/Triple.h> #include <Corrade/Containers/Triple.h>

Loading…
Cancel
Save