Browse Source

GL: use StringView literals for all workaround names.

These are in most cases the only strings that are used, and I don't
think having to call std::strlen() for each of them is a good idea if
we don't need to.
euler-xxx
Vladimír Vondruš 5 years ago
parent
commit
32a7adefed
  1. 10
      src/Magnum/GL/Implementation/BufferState.cpp
  2. 4
      src/Magnum/GL/Implementation/ContextState.cpp
  3. 16
      src/Magnum/GL/Implementation/FramebufferState.cpp
  4. 8
      src/Magnum/GL/Implementation/MeshState.cpp
  5. 8
      src/Magnum/GL/Implementation/QueryState.cpp
  6. 4
      src/Magnum/GL/Implementation/RendererState.cpp
  7. 8
      src/Magnum/GL/Implementation/ShaderProgramState.cpp
  8. 6
      src/Magnum/GL/Implementation/ShaderState.cpp
  9. 30
      src/Magnum/GL/Implementation/TextureState.cpp
  10. 4
      src/Magnum/Platform/GlfwApplication.cpp
  11. 4
      src/Magnum/Platform/Sdl2Application.cpp
  12. 10
      src/Magnum/Platform/WindowlessEglApplication.cpp
  13. 4
      src/Magnum/Platform/WindowlessGlxApplication.cpp
  14. 4
      src/Magnum/Platform/WindowlessWglApplication.cpp
  15. 4
      src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp
  16. 4
      src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp.template

10
src/Magnum/GL/Implementation/BufferState.cpp

@ -34,6 +34,8 @@
namespace Magnum { namespace GL { namespace Implementation { namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
const Buffer::TargetHint BufferState::targetForIndex[] = { const Buffer::TargetHint BufferState::targetForIndex[] = {
Buffer::TargetHint::Array, Buffer::TargetHint::Array,
Buffer::TargetHint::ElementArray, Buffer::TargetHint::ElementArray,
@ -94,7 +96,7 @@ BufferState::BufferState(Context& context, std::vector<std::string>& extensions)
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>() if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
&& (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) ||
context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-buffer-dsa")) context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-buffer-dsa"_s))
#endif #endif
) { ) {
extensions.emplace_back(Extensions::ARB::direct_state_access::string()); extensions.emplace_back(Extensions::ARB::direct_state_access::string());
@ -167,7 +169,7 @@ BufferState::BufferState(Context& context, std::vector<std::string>& extensions)
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>() && if(context.isExtensionSupported<Extensions::ARB::direct_state_access>() &&
(context.detectedDriver() & Context::DetectedDriver::Svga3D) && (context.detectedDriver() & Context::DetectedDriver::Svga3D) &&
!context.isDriverWorkaroundDisabled("svga3d-broken-dsa-bufferdata")) !context.isDriverWorkaroundDisabled("svga3d-broken-dsa-bufferdata"_s))
{ {
dataImplementation = &Buffer::dataImplementationDefault; dataImplementation = &Buffer::dataImplementationDefault;
} }
@ -175,7 +177,7 @@ BufferState::BufferState(Context& context, std::vector<std::string>& extensions)
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if((context.detectedDriver() & Context::DetectedDriver::SwiftShader) && if((context.detectedDriver() & Context::DetectedDriver::SwiftShader) &&
!context.isDriverWorkaroundDisabled("swiftshader-broken-xfb-buffer-binding-target")) !context.isDriverWorkaroundDisabled("swiftshader-broken-xfb-buffer-binding-target"_s))
{ {
setTargetHintImplementation = &Buffer::setTargetHintImplementationSwiftShader; setTargetHintImplementation = &Buffer::setTargetHintImplementationSwiftShader;
} else } else
@ -185,7 +187,7 @@ BufferState::BufferState(Context& context, std::vector<std::string>& extensions)
} }
#if defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_GLES) #if defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_GLES)
if(!context.isDriverWorkaroundDisabled("apple-buffer-texture-unbind-on-buffer-modify")) { if(!context.isDriverWorkaroundDisabled("apple-buffer-texture-unbind-on-buffer-modify"_s)) {
dataImplementation = &Buffer::dataImplementationApple; dataImplementation = &Buffer::dataImplementationApple;
subDataImplementation = &Buffer::subDataImplementationApple; subDataImplementation = &Buffer::subDataImplementationApple;
mapImplementation = &Buffer::mapImplementationApple; mapImplementation = &Buffer::mapImplementationApple;

4
src/Magnum/GL/Implementation/ContextState.cpp

@ -31,10 +31,12 @@
namespace Magnum { namespace GL { namespace Implementation { namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
ContextState::ContextState(Context& context, std::vector<std::string>&) { ContextState::ContextState(Context& context, std::vector<std::string>&) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if((context.detectedDriver() & Context::DetectedDriver::NVidia) && if((context.detectedDriver() & Context::DetectedDriver::NVidia) &&
!context.isDriverWorkaroundDisabled("nv-zero-context-profile-mask")) !context.isDriverWorkaroundDisabled("nv-zero-context-profile-mask"_s))
{ {
isCoreProfileImplementation = &Context::isCoreProfileImplementationNV; isCoreProfileImplementation = &Context::isCoreProfileImplementationNV;
} else isCoreProfileImplementation = &Context::isCoreProfileImplementationDefault; } else isCoreProfileImplementation = &Context::isCoreProfileImplementationDefault;

16
src/Magnum/GL/Implementation/FramebufferState.cpp

@ -35,6 +35,8 @@
namespace Magnum { namespace GL { namespace Implementation { namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
constexpr const Range2Di FramebufferState::DisengagedViewport; constexpr const Range2Di FramebufferState::DisengagedViewport;
FramebufferState::FramebufferState(Context& context, std::vector<std::string>& extensions): readBinding{0}, drawBinding{0}, renderbufferBinding{0}, maxDrawBuffers{0}, maxColorAttachments{0}, maxRenderbufferSize{0}, FramebufferState::FramebufferState(Context& context, std::vector<std::string>& extensions): readBinding{0}, drawBinding{0}, renderbufferBinding{0}, maxDrawBuffers{0}, maxColorAttachments{0}, maxRenderbufferSize{0},
@ -131,10 +133,10 @@ FramebufferState::FramebufferState(Context& context, std::vector<std::string>& e
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) { if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
if(context.detectedDriver() & Context::DetectedDriver::IntelWindows && !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps")) { if(context.detectedDriver() & Context::DetectedDriver::IntelWindows && !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"_s)) {
copySubCubeMapImplementation = &AbstractFramebuffer::copySub2DImplementationDefault; copySubCubeMapImplementation = &AbstractFramebuffer::copySub2DImplementationDefault;
textureCubeMapImplementation = &Framebuffer::texture2DImplementationDefault; textureCubeMapImplementation = &Framebuffer::texture2DImplementationDefault;
} else if(context.detectedDriver() & Context::DetectedDriver::Amd && !context.isDriverWorkaroundDisabled("amd-windows-broken-dsa-cubemap-copy")) { } else if(context.detectedDriver() & Context::DetectedDriver::Amd && !context.isDriverWorkaroundDisabled("amd-windows-broken-dsa-cubemap-copy"_s)) {
copySubCubeMapImplementation = &AbstractFramebuffer::copySub2DImplementationDefault; copySubCubeMapImplementation = &AbstractFramebuffer::copySub2DImplementationDefault;
/* Cube map attachment is not broken */ /* Cube map attachment is not broken */
textureCubeMapImplementation = &Framebuffer::texture2DImplementationDSA; textureCubeMapImplementation = &Framebuffer::texture2DImplementationDSA;
@ -160,7 +162,7 @@ FramebufferState::FramebufferState(Context& context, std::vector<std::string>& e
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>() if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
&& (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) ||
context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-layered-cubemap-array-framebuffer-attachment")) context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-layered-cubemap-array-framebuffer-attachment"_s))
#endif #endif
) { ) {
/* Extension name added above */ /* Extension name added above */
@ -179,7 +181,7 @@ FramebufferState::FramebufferState(Context& context, std::vector<std::string>& e
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>() if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
&& (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) ||
context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-framebuffer-clear")) context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-framebuffer-clear"_s))
#endif #endif
) { ) {
/* Extension name added above */ /* Extension name added above */
@ -288,15 +290,15 @@ FramebufferState::FramebufferState(Context& context, std::vector<std::string>& e
if(context.isVersionSupported(Version::GL450) if(context.isVersionSupported(Version::GL450)
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
&& !((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && && !((context.detectedDriver() & Context::DetectedDriver::IntelWindows) &&
!context.isDriverWorkaroundDisabled("intel-windows-implementation-color-read-format-completely-broken")) !context.isDriverWorkaroundDisabled("intel-windows-implementation-color-read-format-completely-broken"_s))
#endif #endif
) { ) {
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>() if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
&& !((context.detectedDriver() & Context::DetectedDriver::NVidia) && !context.isDriverWorkaroundDisabled("nv-implementation-color-read-format-dsa-broken")) && !((context.detectedDriver() & Context::DetectedDriver::NVidia) && !context.isDriverWorkaroundDisabled("nv-implementation-color-read-format-dsa-broken"_s))
) { ) {
/* DSA extension added above */ /* DSA extension added above */
if((context.detectedDriver() & Context::DetectedDriver::Mesa) && !context.isDriverWorkaroundDisabled("mesa-implementation-color-read-format-dsa-explicit-binding")) if((context.detectedDriver() & Context::DetectedDriver::Mesa) && !context.isDriverWorkaroundDisabled("mesa-implementation-color-read-format-dsa-explicit-binding"_s))
implementationColorReadFormatTypeImplementation = &AbstractFramebuffer::implementationColorReadFormatTypeImplementationFramebufferDSAMesa; implementationColorReadFormatTypeImplementation = &AbstractFramebuffer::implementationColorReadFormatTypeImplementationFramebufferDSAMesa;
else implementationColorReadFormatTypeImplementation = &AbstractFramebuffer::implementationColorReadFormatTypeImplementationFramebufferDSA; else implementationColorReadFormatTypeImplementation = &AbstractFramebuffer::implementationColorReadFormatTypeImplementationFramebufferDSA;
} else { } else {

8
src/Magnum/GL/Implementation/MeshState.cpp

@ -35,6 +35,8 @@
namespace Magnum { namespace GL { namespace Implementation { namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
MeshState::MeshState(Context& context, ContextState& contextState, std::vector<std::string>& extensions): currentVAO(0) MeshState::MeshState(Context& context, ContextState& contextState, std::vector<std::string>& extensions): currentVAO(0)
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
, maxElementIndex{0}, maxElementsIndices{0}, maxElementsVertices{0} , maxElementIndex{0}, maxElementsIndices{0}, maxElementsVertices{0}
@ -59,7 +61,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, std::vector<s
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>() if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
&& (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) ||
context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-vao-dsa")) context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-vao-dsa"_s))
#endif #endif
) { ) {
extensions.emplace_back(Extensions::ARB::direct_state_access::string()); extensions.emplace_back(Extensions::ARB::direct_state_access::string());
@ -67,7 +69,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, std::vector<s
/* Intel Windows drivers are ... special */ /* Intel Windows drivers are ... special */
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) &&
!context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-integer-vertex-attributes")) !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-integer-vertex-attributes"_s))
{ {
attributePointerImplementation = &Mesh::attributePointerImplementationVAODSAIntelWindows; attributePointerImplementation = &Mesh::attributePointerImplementationVAODSAIntelWindows;
} else } else
@ -328,7 +330,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, std::vector<s
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>() if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
&& (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) ||
context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-vao-dsa")) context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-vao-dsa"_s))
#endif #endif
) )
vertexAttribDivisorImplementation = &Mesh::vertexAttribDivisorImplementationVAODSA; vertexAttribDivisorImplementation = &Mesh::vertexAttribDivisorImplementationVAODSA;

8
src/Magnum/GL/Implementation/QueryState.cpp

@ -33,19 +33,21 @@
namespace Magnum { namespace GL { namespace Implementation { namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
QueryState::QueryState(Context& context, std::vector<std::string>& extensions) { QueryState::QueryState(Context& context, std::vector<std::string>& extensions) {
/* Create implementation */ /* Create implementation */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) { if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-indexed-queries")) { if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-indexed-queries"_s)) {
createImplementation = &AbstractQuery::createImplementationDefault; createImplementation = &AbstractQuery::createImplementationDefault;
} else if((context.detectedDriver() & Context::DetectedDriver::Amd) && !context.isDriverWorkaroundDisabled("amd-windows-dsa-createquery-except-xfb-overflow")) { } else if((context.detectedDriver() & Context::DetectedDriver::Amd) && !context.isDriverWorkaroundDisabled("amd-windows-dsa-createquery-except-xfb-overflow"_s)) {
extensions.emplace_back(Extensions::ARB::direct_state_access::string()); extensions.emplace_back(Extensions::ARB::direct_state_access::string());
createImplementation = &AbstractQuery::createImplementationDSAExceptXfbOverflow; createImplementation = &AbstractQuery::createImplementationDSAExceptXfbOverflow;
} else } else
#endif #endif
if((context.detectedDriver() & Context::DetectedDriver::Mesa) && !context.isDriverWorkaroundDisabled("mesa-dsa-createquery-except-pipeline-stats")) { if((context.detectedDriver() & Context::DetectedDriver::Mesa) && !context.isDriverWorkaroundDisabled("mesa-dsa-createquery-except-pipeline-stats"_s)) {
extensions.emplace_back(Extensions::ARB::direct_state_access::string()); extensions.emplace_back(Extensions::ARB::direct_state_access::string());
createImplementation = &AbstractQuery::createImplementationDSAExceptPipelineStats; createImplementation = &AbstractQuery::createImplementationDSAExceptPipelineStats;
} else { } else {

4
src/Magnum/GL/Implementation/RendererState.cpp

@ -33,6 +33,8 @@
namespace Magnum { namespace GL { namespace Implementation { namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
RendererState::RendererState(Context& context, ContextState& contextState, std::vector<std::string>& extensions) RendererState::RendererState(Context& context, ContextState& contextState, std::vector<std::string>& extensions)
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
: resetNotificationStrategy() : resetNotificationStrategy()
@ -90,7 +92,7 @@ RendererState::RendererState(Context& context, ContextState& contextState, std::
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if((context.detectedDriver() & Context::DetectedDriver::Mesa) && if((context.detectedDriver() & Context::DetectedDriver::Mesa) &&
(context.flags() & Context::Flag::ForwardCompatible) && (context.flags() & Context::Flag::ForwardCompatible) &&
!context.isDriverWorkaroundDisabled("mesa-forward-compatible-line-width-range")) !context.isDriverWorkaroundDisabled("mesa-forward-compatible-line-width-range"_s))
lineWidthRangeImplementation = &Renderer::lineWidthRangeImplementationMesaForwardCompatible; lineWidthRangeImplementation = &Renderer::lineWidthRangeImplementationMesaForwardCompatible;
else else
#endif #endif

8
src/Magnum/GL/Implementation/ShaderProgramState.cpp

@ -35,6 +35,8 @@
namespace Magnum { namespace GL { namespace Implementation { namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
ShaderProgramState::ShaderProgramState(Context& context, std::vector<std::string>& extensions): current(0), maxVertexAttributes(0) ShaderProgramState::ShaderProgramState(Context& context, std::vector<std::string>& extensions): current(0), maxVertexAttributes(0)
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
@ -52,7 +54,7 @@ ShaderProgramState::ShaderProgramState(Context& context, std::vector<std::string
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
if((context.detectedDriver() & Context::DetectedDriver::NVidia) && if((context.detectedDriver() & Context::DetectedDriver::NVidia) &&
!context.isDriverWorkaroundDisabled("nv-windows-dangling-transform-feedback-varying-names")) !context.isDriverWorkaroundDisabled("nv-windows-dangling-transform-feedback-varying-names"_s))
{ {
transformFeedbackVaryingsImplementation = &AbstractShaderProgram::transformFeedbackVaryingsImplementationDanglingWorkaround; transformFeedbackVaryingsImplementation = &AbstractShaderProgram::transformFeedbackVaryingsImplementationDanglingWorkaround;
} else } else
@ -63,12 +65,12 @@ ShaderProgramState::ShaderProgramState(Context& context, std::vector<std::string
#endif #endif
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_TARGET_GLES) #if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_TARGET_GLES)
if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && !context.isDriverWorkaroundDisabled("intel-windows-chatty-shader-compiler")) { if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && !context.isDriverWorkaroundDisabled("intel-windows-chatty-shader-compiler"_s)) {
cleanLogImplementation = &AbstractShaderProgram::cleanLogImplementationIntelWindows; cleanLogImplementation = &AbstractShaderProgram::cleanLogImplementationIntelWindows;
} else } else
#endif #endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
if((context.detectedDriver() & Context::DetectedDriver::Angle) && !context.isDriverWorkaroundDisabled("angle-chatty-shader-compiler")) { if((context.detectedDriver() & Context::DetectedDriver::Angle) && !context.isDriverWorkaroundDisabled("angle-chatty-shader-compiler"_s)) {
cleanLogImplementation = &AbstractShaderProgram::cleanLogImplementationAngle; cleanLogImplementation = &AbstractShaderProgram::cleanLogImplementationAngle;
} else } else
#endif #endif

6
src/Magnum/GL/Implementation/ShaderState.cpp

@ -34,6 +34,8 @@
namespace Magnum { namespace GL { namespace Implementation { namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
ShaderState::ShaderState(Context& context, std::vector<std::string>&): ShaderState::ShaderState(Context& context, std::vector<std::string>&):
maxVertexOutputComponents{}, maxFragmentInputComponents{}, maxVertexOutputComponents{}, maxFragmentInputComponents{},
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
@ -49,7 +51,7 @@ ShaderState::ShaderState(Context& context, std::vector<std::string>&):
#endif #endif
{ {
#if defined(CORRADE_TARGET_EMSCRIPTEN) && defined(__EMSCRIPTEN_PTHREADS__) #if defined(CORRADE_TARGET_EMSCRIPTEN) && defined(__EMSCRIPTEN_PTHREADS__)
if(!context.isDriverWorkaroundDisabled("emscripten-pthreads-broken-unicode-shader-sources")) { if(!context.isDriverWorkaroundDisabled("emscripten-pthreads-broken-unicode-shader-sources"_s)) {
addSourceImplementation = &Shader::addSourceImplementationEmscriptenPthread; addSourceImplementation = &Shader::addSourceImplementationEmscriptenPthread;
} else } else
#endif #endif
@ -58,7 +60,7 @@ ShaderState::ShaderState(Context& context, std::vector<std::string>&):
} }
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_TARGET_GLES) #if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_TARGET_GLES)
if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && !context.isDriverWorkaroundDisabled("intel-windows-chatty-shader-compiler")) { if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && !context.isDriverWorkaroundDisabled("intel-windows-chatty-shader-compiler"_s)) {
cleanLogImplementation = &Shader::cleanLogImplementationIntelWindows; cleanLogImplementation = &Shader::cleanLogImplementationIntelWindows;
} else } else
#endif #endif

30
src/Magnum/GL/Implementation/TextureState.cpp

@ -41,6 +41,8 @@
namespace Magnum { namespace GL { namespace Implementation { namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
TextureState::TextureState(Context& context, std::vector<std::string>& extensions): maxSize{}, TextureState::TextureState(Context& context, std::vector<std::string>& extensions): maxSize{},
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
max3DSize{}, max3DSize{},
@ -83,7 +85,7 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) &&
!context.isDriverWorkaroundDisabled("intel-windows-half-baked-dsa-texture-bind")) !context.isDriverWorkaroundDisabled("intel-windows-half-baked-dsa-texture-bind"_s))
{ {
unbindImplementation = &AbstractTexture::unbindImplementationDefault; unbindImplementation = &AbstractTexture::unbindImplementationDefault;
bindImplementation = &AbstractTexture::bindImplementationDSAIntelWindows; bindImplementation = &AbstractTexture::bindImplementationDSAIntelWindows;
@ -185,11 +187,11 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) { if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps")) { if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"_s)) {
getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDefault; getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDefault;
cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDefault; cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDefault;
cubeCompressedSubImageImplementation = &CubeMapTexture::compressedSubImageImplementationDefault; cubeCompressedSubImageImplementation = &CubeMapTexture::compressedSubImageImplementationDefault;
} else if((context.detectedDriver() & Context::DetectedDriver::Amd) && !context.isDriverWorkaroundDisabled("amd-windows-cubemap-image3d-slice-by-slice")) { } else if((context.detectedDriver() & Context::DetectedDriver::Amd) && !context.isDriverWorkaroundDisabled("amd-windows-cubemap-image3d-slice-by-slice"_s)) {
/* This one is not broken, but the others are */ /* This one is not broken, but the others are */
getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDSA; getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDSA;
cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDefault; cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDefault;
@ -257,14 +259,14 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
/* Compressed cubemap image size query implementation (extensions added /* Compressed cubemap image size query implementation (extensions added
above) */ above) */
if((context.detectedDriver() & Context::DetectedDriver::NVidia) && if((context.detectedDriver() & Context::DetectedDriver::NVidia) &&
!context.isDriverWorkaroundDisabled("nv-cubemap-inconsistent-compressed-image-size")) { !context.isDriverWorkaroundDisabled("nv-cubemap-inconsistent-compressed-image-size"_s)) {
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) if(context.isExtensionSupported<Extensions::ARB::direct_state_access>())
getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSANonImmutableWorkaround; getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSANonImmutableWorkaround;
else getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDefaultImmutableWorkaround; else getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDefaultImmutableWorkaround;
} else if(context.isExtensionSupported<Extensions::ARB::direct_state_access>() } else if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
&& (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) ||
context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps")) context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"_s))
#endif #endif
) { ) {
getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSA; getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSA;
@ -308,7 +310,7 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
above) */ above) */
if((context.detectedDriver() & Context::DetectedDriver::NVidia) && if((context.detectedDriver() & Context::DetectedDriver::NVidia) &&
context.isExtensionSupported<Extensions::ARB::direct_state_access>() && context.isExtensionSupported<Extensions::ARB::direct_state_access>() &&
!context.isDriverWorkaroundDisabled("nv-cubemap-broken-full-compressed-image-query")) !context.isDriverWorkaroundDisabled("nv-cubemap-broken-full-compressed-image-query"_s))
getFullCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDSASingleSliceWorkaround; getFullCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDSASingleSliceWorkaround;
else else
getFullCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDSA; getFullCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDSA;
@ -318,11 +320,11 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
linux as well, test */ linux as well, test */
if((context.detectedDriver() & Context::DetectedDriver::Amd) && if((context.detectedDriver() & Context::DetectedDriver::Amd) &&
context.isExtensionSupported<Extensions::ARB::direct_state_access>() && context.isExtensionSupported<Extensions::ARB::direct_state_access>() &&
!context.isDriverWorkaroundDisabled("amd-windows-cubemap-image3d-slice-by-slice")) !context.isDriverWorkaroundDisabled("amd-windows-cubemap-image3d-slice-by-slice"_s))
getFullCubeImageImplementation = &CubeMapTexture::getImageImplementationDSAAmdSliceBySlice; getFullCubeImageImplementation = &CubeMapTexture::getImageImplementationDSAAmdSliceBySlice;
else if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && else if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) &&
context.isExtensionSupported<Extensions::ARB::direct_state_access>() && context.isExtensionSupported<Extensions::ARB::direct_state_access>() &&
!context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps")) !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"_s))
getFullCubeImageImplementation = &CubeMapTexture::getImageImplementationSliceBySlice; getFullCubeImageImplementation = &CubeMapTexture::getImageImplementationSliceBySlice;
else else
#endif #endif
@ -426,7 +428,7 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* NVidia workaround for compressed block data size implementation */ /* NVidia workaround for compressed block data size implementation */
if((context.detectedDriver() & Context::DetectedDriver::NVidia) && if((context.detectedDriver() & Context::DetectedDriver::NVidia) &&
!context.isDriverWorkaroundDisabled("nv-compressed-block-size-in-bits")) !context.isDriverWorkaroundDisabled("nv-compressed-block-size-in-bits"_s))
compressedBlockDataSizeImplementation = &AbstractTexture::compressedBlockDataSizeImplementationBitsWorkaround; compressedBlockDataSizeImplementation = &AbstractTexture::compressedBlockDataSizeImplementationBitsWorkaround;
else else
compressedBlockDataSizeImplementation = &AbstractTexture::compressedBlockDataSizeImplementationDefault; compressedBlockDataSizeImplementation = &AbstractTexture::compressedBlockDataSizeImplementationDefault;
@ -436,7 +438,7 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
/* SVGA3D workaround for array / 3D / cube map texture upload. Overrides /* SVGA3D workaround for array / 3D / cube map texture upload. Overrides
the DSA / non-DSA function pointers set above. */ the DSA / non-DSA function pointers set above. */
if((context.detectedDriver() & Context::DetectedDriver::Svga3D) && if((context.detectedDriver() & Context::DetectedDriver::Svga3D) &&
!context.isDriverWorkaroundDisabled("svga3d-texture-upload-slice-by-slice")) { !context.isDriverWorkaroundDisabled("svga3d-texture-upload-slice-by-slice"_s)) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
image2DImplementation = &AbstractTexture::imageImplementationSvga3DSliceBySlice; image2DImplementation = &AbstractTexture::imageImplementationSvga3DSliceBySlice;
#endif #endif
@ -470,21 +472,21 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
/* SVGA3D and Intel workaround for cube map texture upload. Overrides the /* SVGA3D and Intel workaround for cube map texture upload. Overrides the
DSA / non-DSA function pointers set above. */ DSA / non-DSA function pointers set above. */
if((context.detectedDriver() & Context::DetectedDriver::Svga3D) && if((context.detectedDriver() & Context::DetectedDriver::Svga3D) &&
!context.isDriverWorkaroundDisabled("svga3d-texture-upload-slice-by-slice")) { !context.isDriverWorkaroundDisabled("svga3d-texture-upload-slice-by-slice"_s)) {
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) { if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationDSASliceBySlice; cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationDSASliceBySlice;
} else { } else {
cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationSliceBySlice; cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationSliceBySlice;
} }
} else if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && } else if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) &&
!context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps")) { !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"_s)) {
cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationSliceBySlice; cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationSliceBySlice;
} }
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
/** @todo those *might* be happening with the proprietary AMD driver on /** @todo those *might* be happening with the proprietary AMD driver on
linux as well, test */ linux as well, test */
else if((context.detectedDriver() & Context::DetectedDriver::Amd) && else if((context.detectedDriver() & Context::DetectedDriver::Amd) &&
!context.isDriverWorkaroundDisabled("amd-windows-cubemap-image3d-slice-by-slice")) { !context.isDriverWorkaroundDisabled("amd-windows-cubemap-image3d-slice-by-slice"_s)) {
/* DSA version is broken (non-zero Z offset not allowed), need to /* DSA version is broken (non-zero Z offset not allowed), need to
emulate using classic APIs */ emulate using classic APIs */
cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationSliceBySlice; cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationSliceBySlice;
@ -504,7 +506,7 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
bindings = Containers::Array<std::pair<GLenum, GLuint>>{Containers::ValueInit, std::size_t(maxTextureUnits)}; bindings = Containers::Array<std::pair<GLenum, GLuint>>{Containers::ValueInit, std::size_t(maxTextureUnits)};
#if defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_GLES) #if defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_GLES)
if(!context.isDriverWorkaroundDisabled("apple-buffer-texture-unbind-on-buffer-modify")) { if(!context.isDriverWorkaroundDisabled("apple-buffer-texture-unbind-on-buffer-modify"_s)) {
CORRADE_INTERNAL_ASSERT(std::size_t(maxTextureUnits) <= decltype(bufferTextureBound)::Size); CORRADE_INTERNAL_ASSERT(std::size_t(maxTextureUnits) <= decltype(bufferTextureBound)::Size);
/* Assume ARB_multi_bind is not supported, otherwise we'd need to /* Assume ARB_multi_bind is not supported, otherwise we'd need to
implement the workaround also for bindMultiImplementation */ implement the workaround also for bindMultiImplementation */

4
src/Magnum/Platform/GlfwApplication.cpp

@ -49,6 +49,8 @@
namespace Magnum { namespace Platform { namespace Magnum { namespace Platform {
using namespace Containers::Literals;
#ifdef GLFW_TRUE #ifdef GLFW_TRUE
/* The docs say that it's the same, verify that just in case */ /* The docs say that it's the same, verify that just in case */
static_assert(GLFW_TRUE == true && GLFW_FALSE == false, "GLFW does not have sane bool values"); static_assert(GLFW_TRUE == true && GLFW_FALSE == false, "GLFW does not have sane bool values");
@ -532,7 +534,7 @@ bool GlfwApplication::tryCreate(const Configuration& configuration, const GLConf
std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 0 || std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 0 ||
#endif #endif
std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0)
&& !_context->isDriverWorkaroundDisabled("no-forward-compatible-core-context")) && !_context->isDriverWorkaroundDisabled("no-forward-compatible-core-context"_s))
#endif #endif
)) { )) {
/* Don't print any warning when doing the workaround, because the bug /* Don't print any warning when doing the workaround, because the bug

4
src/Magnum/Platform/Sdl2Application.cpp

@ -69,6 +69,8 @@
namespace Magnum { namespace Platform { namespace Magnum { namespace Platform {
using namespace Containers::Literals;
namespace { namespace {
/* /*
@ -560,7 +562,7 @@ bool Sdl2Application::tryCreate(const Configuration& configuration, const GLConf
std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 0 || std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 0 ||
#endif #endif
std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0)
&& !_context->isDriverWorkaroundDisabled("no-forward-compatible-core-context")) && !_context->isDriverWorkaroundDisabled("no-forward-compatible-core-context"_s))
#endif #endif
)) { )) {
/* Don't print any warning when doing the workaround, because the bug /* Don't print any warning when doing the workaround, because the bug

10
src/Magnum/Platform/WindowlessEglApplication.cpp

@ -72,6 +72,8 @@ typedef void (APIENTRY *EGLDEBUGPROCKHR)(EGLenum error, const char* command, EGL
namespace Magnum { namespace Platform { namespace Magnum { namespace Platform {
using namespace Containers::Literals;
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
namespace { namespace {
@ -190,7 +192,7 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G
well-behaved driver versions, eglQueryDeviceAttribEXT() well-behaved driver versions, eglQueryDeviceAttribEXT()
returns false instead of segfaulting. */ returns false instead of segfaulting. */
const char* const eglExtensions = eglQueryDeviceStringEXT(devices[selectedDevice], EGL_EXTENSIONS); const char* const eglExtensions = eglQueryDeviceStringEXT(devices[selectedDevice], EGL_EXTENSIONS);
if(eglGetError() == EGL_BAD_DEVICE_EXT && !magnumContext->isDriverWorkaroundDisabled("nv-egl-crashy-query-device-attrib")) if(eglGetError() == EGL_BAD_DEVICE_EXT && !magnumContext->isDriverWorkaroundDisabled("nv-egl-crashy-query-device-attrib"_s))
continue; continue;
if(magnumContext && (magnumContext->internalFlags() >= GL::Context::InternalFlag::DisplayVerboseInitializationLog)) if(magnumContext && (magnumContext->internalFlags() >= GL::Context::InternalFlag::DisplayVerboseInitializationLog))
@ -344,7 +346,7 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G
a zero value, so erase these. It also doesn't handle them as correct a zero value, so erase these. It also doesn't handle them as correct
flags, but instead checks for the whole value, so a combination won't flags, but instead checks for the whole value, so a combination won't
work either: https://github.com/google/swiftshader/blob/5fb5e817a20d3e60f29f7338493f922b5ac9d7c4/src/OpenGL/libEGL/libEGL.cpp#L794-L8104 */ work either: https://github.com/google/swiftshader/blob/5fb5e817a20d3e60f29f7338493f922b5ac9d7c4/src/OpenGL/libEGL/libEGL.cpp#L794-L8104 */
if(!configuration.flags() && version && std::strstr(version, "SwiftShader") != nullptr && (!magnumContext || !magnumContext->isDriverWorkaroundDisabled("swiftshader-no-empty-egl-context-flags"))) { if(!configuration.flags() && version && std::strstr(version, "SwiftShader") != nullptr && (!magnumContext || !magnumContext->isDriverWorkaroundDisabled("swiftshader-no-empty-egl-context-flags"_s))) {
auto& contextFlags = attributes[Containers::arraySize(attributes) - 3]; auto& contextFlags = attributes[Containers::arraySize(attributes) - 3];
CORRADE_INTERNAL_ASSERT(contextFlags == EGL_CONTEXT_FLAGS_KHR); CORRADE_INTERNAL_ASSERT(contextFlags == EGL_CONTEXT_FLAGS_KHR);
contextFlags = EGL_NONE; contextFlags = EGL_NONE;
@ -399,7 +401,7 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G
strncmp() */ strncmp() */
if(vendorString && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 || if(vendorString && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 ||
std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) && std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) &&
(!magnumContext || !magnumContext->isDriverWorkaroundDisabled("no-forward-compatible-core-context"))) (!magnumContext || !magnumContext->isDriverWorkaroundDisabled("no-forward-compatible-core-context"_s)))
{ {
/* Destroy the core context and create a compatibility one */ /* Destroy the core context and create a compatibility one */
eglDestroyContext(_display, _context); eglDestroyContext(_display, _context);
@ -430,7 +432,7 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
/* SwiftShader 3.3.0.1 needs some pbuffer, otherwise it crashes somewhere /* SwiftShader 3.3.0.1 needs some pbuffer, otherwise it crashes somewhere
deep inside when making the context current */ deep inside when making the context current */
if(version && std::strstr(version, "SwiftShader") != nullptr && (!magnumContext || !magnumContext->isDriverWorkaroundDisabled("swiftshader-egl-context-needs-pbuffer"))) { if(version && std::strstr(version, "SwiftShader") != nullptr && (!magnumContext || !magnumContext->isDriverWorkaroundDisabled("swiftshader-egl-context-needs-pbuffer"_s))) {
EGLint surfaceAttributes[] = { EGLint surfaceAttributes[] = {
EGL_WIDTH, 32, EGL_WIDTH, 32,
EGL_HEIGHT, 32, EGL_HEIGHT, 32,

4
src/Magnum/Platform/WindowlessGlxApplication.cpp

@ -39,6 +39,8 @@ namespace { enum { None = 0, Success = 0 }; }
namespace Magnum { namespace Platform { namespace Magnum { namespace Platform {
using namespace Containers::Literals;
namespace { namespace {
/* /*
@ -188,7 +190,7 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
strncmp() */ strncmp() */
if(vendorString && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 || if(vendorString && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 ||
std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) && std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) &&
(!magnumContext || !magnumContext->isDriverWorkaroundDisabled("no-forward-compatible-core-context"))) (!magnumContext || !magnumContext->isDriverWorkaroundDisabled("no-forward-compatible-core-context"_s)))
{ {
/* Destroy the core context and create a compatibility one */ /* Destroy the core context and create a compatibility one */
glXDestroyContext(_display, _context); glXDestroyContext(_display, _context);

4
src/Magnum/Platform/WindowlessWglApplication.cpp

@ -46,6 +46,8 @@
namespace Magnum { namespace Platform { namespace Magnum { namespace Platform {
using namespace Containers::Literals;
WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, GLContext* const magnumContext) { WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, GLContext* const magnumContext) {
/* Register the window class (if not yet done) */ /* Register the window class (if not yet done) */
WNDCLASSW wc; WNDCLASSW wc;
@ -188,7 +190,7 @@ WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, G
if(vendorString && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 || if(vendorString && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 ||
std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 0 || std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 0 ||
std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) && std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) &&
(!magnumContext || !magnumContext->isDriverWorkaroundDisabled("no-forward-compatible-core-context"))) (!magnumContext || !magnumContext->isDriverWorkaroundDisabled("no-forward-compatible-core-context"_s)))
{ {
/* Destroy the core context and create a compatibility one */ /* Destroy the core context and create a compatibility one */
wglDeleteContext(_context); wglDeleteContext(_context);

4
src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp vendored

@ -42,12 +42,14 @@ void flextGLInit(Magnum::GL::Context& context) {
#ifdef MAGNUM_PLATFORM_USE_EGL #ifdef MAGNUM_PLATFORM_USE_EGL
{ {
using namespace Corrade::Containers::Literals;
/* EGL contexts on NVidia 390 drivers don't have correct statically /* EGL contexts on NVidia 390 drivers don't have correct statically
linked GL 1.0 and 1.1 functions (such as glGetString()) and one has linked GL 1.0 and 1.1 functions (such as glGetString()) and one has
to retrieve them explicitly using eglGetProcAddress(). */ to retrieve them explicitly using eglGetProcAddress(). */
EGLDisplay display = eglGetCurrentDisplay(); EGLDisplay display = eglGetCurrentDisplay();
const char* vendor = eglQueryString(display, EGL_VENDOR); const char* vendor = eglQueryString(display, EGL_VENDOR);
if(std::strcmp(vendor, "NVIDIA") == 0 && !context.isDriverWorkaroundDisabled("nv-egl-incorrect-gl11-function-pointers")) { if(std::strcmp(vendor, "NVIDIA") == 0 && !context.isDriverWorkaroundDisabled("nv-egl-incorrect-gl11-function-pointers"_s)) {
/* GL_VERSION_1_0 */ /* GL_VERSION_1_0 */
flextGL.BlendFunc = reinterpret_cast<void(APIENTRY*)(GLenum, GLenum)>(loader.load("glBlendFunc")); flextGL.BlendFunc = reinterpret_cast<void(APIENTRY*)(GLenum, GLenum)>(loader.load("glBlendFunc"));

4
src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp.template vendored

@ -43,12 +43,14 @@ void flextGLInit(Magnum::GL::Context& context) {
#ifdef MAGNUM_PLATFORM_USE_EGL #ifdef MAGNUM_PLATFORM_USE_EGL
{ {
using namespace Corrade::Containers::Literals;
/* EGL contexts on NVidia 390 drivers don't have correct statically /* EGL contexts on NVidia 390 drivers don't have correct statically
linked GL 1.0 and 1.1 functions (such as glGetString()) and one has linked GL 1.0 and 1.1 functions (such as glGetString()) and one has
to retrieve them explicitly using eglGetProcAddress(). */ to retrieve them explicitly using eglGetProcAddress(). */
EGLDisplay display = eglGetCurrentDisplay(); EGLDisplay display = eglGetCurrentDisplay();
const char* vendor = eglQueryString(display, EGL_VENDOR); const char* vendor = eglQueryString(display, EGL_VENDOR);
if(std::strcmp(vendor, "NVIDIA") == 0 && !context.isDriverWorkaroundDisabled("nv-egl-incorrect-gl11-function-pointers")) { if(std::strcmp(vendor, "NVIDIA") == 0 && !context.isDriverWorkaroundDisabled("nv-egl-incorrect-gl11-function-pointers"_s)) {
@for category,funcs in functions: @for category,funcs in functions:
@if funcs and category in ['VERSION_1_0', 'VERSION_1_1']: @if funcs and category in ['VERSION_1_0', 'VERSION_1_1']:

Loading…
Cancel
Save