From 32a7adefed8678a927d35056acaab4c1928eac76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 22 Feb 2021 17:57:27 +0100 Subject: [PATCH] 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. --- src/Magnum/GL/Implementation/BufferState.cpp | 10 ++++--- src/Magnum/GL/Implementation/ContextState.cpp | 4 ++- .../GL/Implementation/FramebufferState.cpp | 16 +++++----- src/Magnum/GL/Implementation/MeshState.cpp | 8 +++-- src/Magnum/GL/Implementation/QueryState.cpp | 8 +++-- .../GL/Implementation/RendererState.cpp | 4 ++- .../GL/Implementation/ShaderProgramState.cpp | 8 +++-- src/Magnum/GL/Implementation/ShaderState.cpp | 6 ++-- src/Magnum/GL/Implementation/TextureState.cpp | 30 ++++++++++--------- src/Magnum/Platform/GlfwApplication.cpp | 4 ++- src/Magnum/Platform/Sdl2Application.cpp | 4 ++- .../Platform/WindowlessEglApplication.cpp | 10 ++++--- .../Platform/WindowlessGlxApplication.cpp | 4 ++- .../Platform/WindowlessWglApplication.cpp | 4 ++- .../OpenGL/GL/flextGLPlatform.cpp | 4 ++- .../OpenGL/GL/flextGLPlatform.cpp.template | 4 ++- 16 files changed, 80 insertions(+), 48 deletions(-) diff --git a/src/Magnum/GL/Implementation/BufferState.cpp b/src/Magnum/GL/Implementation/BufferState.cpp index c3b056da7..60a4f78df 100644 --- a/src/Magnum/GL/Implementation/BufferState.cpp +++ b/src/Magnum/GL/Implementation/BufferState.cpp @@ -34,6 +34,8 @@ namespace Magnum { namespace GL { namespace Implementation { +using namespace Containers::Literals; + const Buffer::TargetHint BufferState::targetForIndex[] = { Buffer::TargetHint::Array, Buffer::TargetHint::ElementArray, @@ -94,7 +96,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) if(context.isExtensionSupported() #ifdef CORRADE_TARGET_WINDOWS && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || - context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-buffer-dsa")) + context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-buffer-dsa"_s)) #endif ) { extensions.emplace_back(Extensions::ARB::direct_state_access::string()); @@ -167,7 +169,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported() && (context.detectedDriver() & Context::DetectedDriver::Svga3D) && - !context.isDriverWorkaroundDisabled("svga3d-broken-dsa-bufferdata")) + !context.isDriverWorkaroundDisabled("svga3d-broken-dsa-bufferdata"_s)) { dataImplementation = &Buffer::dataImplementationDefault; } @@ -175,7 +177,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) 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; } else @@ -185,7 +187,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) } #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; subDataImplementation = &Buffer::subDataImplementationApple; mapImplementation = &Buffer::mapImplementationApple; diff --git a/src/Magnum/GL/Implementation/ContextState.cpp b/src/Magnum/GL/Implementation/ContextState.cpp index da6478547..e9fae46a5 100644 --- a/src/Magnum/GL/Implementation/ContextState.cpp +++ b/src/Magnum/GL/Implementation/ContextState.cpp @@ -31,10 +31,12 @@ namespace Magnum { namespace GL { namespace Implementation { +using namespace Containers::Literals; + ContextState::ContextState(Context& context, std::vector&) { #ifndef MAGNUM_TARGET_GLES if((context.detectedDriver() & Context::DetectedDriver::NVidia) && - !context.isDriverWorkaroundDisabled("nv-zero-context-profile-mask")) + !context.isDriverWorkaroundDisabled("nv-zero-context-profile-mask"_s)) { isCoreProfileImplementation = &Context::isCoreProfileImplementationNV; } else isCoreProfileImplementation = &Context::isCoreProfileImplementationDefault; diff --git a/src/Magnum/GL/Implementation/FramebufferState.cpp b/src/Magnum/GL/Implementation/FramebufferState.cpp index 1f07ca2e5..bae28c63e 100644 --- a/src/Magnum/GL/Implementation/FramebufferState.cpp +++ b/src/Magnum/GL/Implementation/FramebufferState.cpp @@ -35,6 +35,8 @@ namespace Magnum { namespace GL { namespace Implementation { +using namespace Containers::Literals; + constexpr const Range2Di FramebufferState::DisengagedViewport; FramebufferState::FramebufferState(Context& context, std::vector& extensions): readBinding{0}, drawBinding{0}, renderbufferBinding{0}, maxDrawBuffers{0}, maxColorAttachments{0}, maxRenderbufferSize{0}, @@ -131,10 +133,10 @@ FramebufferState::FramebufferState(Context& context, std::vector& e #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { #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; 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; /* Cube map attachment is not broken */ textureCubeMapImplementation = &Framebuffer::texture2DImplementationDSA; @@ -160,7 +162,7 @@ FramebufferState::FramebufferState(Context& context, std::vector& e if(context.isExtensionSupported() #ifdef CORRADE_TARGET_WINDOWS && (!(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 ) { /* Extension name added above */ @@ -179,7 +181,7 @@ FramebufferState::FramebufferState(Context& context, std::vector& e if(context.isExtensionSupported() #ifdef CORRADE_TARGET_WINDOWS && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || - context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-framebuffer-clear")) + context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-framebuffer-clear"_s)) #endif ) { /* Extension name added above */ @@ -288,15 +290,15 @@ FramebufferState::FramebufferState(Context& context, std::vector& e if(context.isVersionSupported(Version::GL450) #ifdef CORRADE_TARGET_WINDOWS && !((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 ) { if(context.isExtensionSupported() - && !((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 */ - 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; else implementationColorReadFormatTypeImplementation = &AbstractFramebuffer::implementationColorReadFormatTypeImplementationFramebufferDSA; } else { diff --git a/src/Magnum/GL/Implementation/MeshState.cpp b/src/Magnum/GL/Implementation/MeshState.cpp index c5320a2ee..cd44de651 100644 --- a/src/Magnum/GL/Implementation/MeshState.cpp +++ b/src/Magnum/GL/Implementation/MeshState.cpp @@ -35,6 +35,8 @@ namespace Magnum { namespace GL { namespace Implementation { +using namespace Containers::Literals; + MeshState::MeshState(Context& context, ContextState& contextState, std::vector& extensions): currentVAO(0) #ifndef MAGNUM_TARGET_GLES2 , maxElementIndex{0}, maxElementsIndices{0}, maxElementsVertices{0} @@ -59,7 +61,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, std::vector() #ifdef CORRADE_TARGET_WINDOWS && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || - context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-vao-dsa")) + context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-vao-dsa"_s)) #endif ) { extensions.emplace_back(Extensions::ARB::direct_state_access::string()); @@ -67,7 +69,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, std::vector() #ifdef CORRADE_TARGET_WINDOWS && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || - context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-vao-dsa")) + context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-vao-dsa"_s)) #endif ) vertexAttribDivisorImplementation = &Mesh::vertexAttribDivisorImplementationVAODSA; diff --git a/src/Magnum/GL/Implementation/QueryState.cpp b/src/Magnum/GL/Implementation/QueryState.cpp index b2c4606a5..41fb3168d 100644 --- a/src/Magnum/GL/Implementation/QueryState.cpp +++ b/src/Magnum/GL/Implementation/QueryState.cpp @@ -33,19 +33,21 @@ namespace Magnum { namespace GL { namespace Implementation { +using namespace Containers::Literals; + QueryState::QueryState(Context& context, std::vector& extensions) { /* Create implementation */ #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { #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; - } 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()); createImplementation = &AbstractQuery::createImplementationDSAExceptXfbOverflow; } else #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()); createImplementation = &AbstractQuery::createImplementationDSAExceptPipelineStats; } else { diff --git a/src/Magnum/GL/Implementation/RendererState.cpp b/src/Magnum/GL/Implementation/RendererState.cpp index 1e909a992..6ebd3f909 100644 --- a/src/Magnum/GL/Implementation/RendererState.cpp +++ b/src/Magnum/GL/Implementation/RendererState.cpp @@ -33,6 +33,8 @@ namespace Magnum { namespace GL { namespace Implementation { +using namespace Containers::Literals; + RendererState::RendererState(Context& context, ContextState& contextState, std::vector& extensions) #ifndef MAGNUM_TARGET_WEBGL : resetNotificationStrategy() @@ -90,7 +92,7 @@ RendererState::RendererState(Context& context, ContextState& contextState, std:: #ifndef MAGNUM_TARGET_GLES if((context.detectedDriver() & Context::DetectedDriver::Mesa) && (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; else #endif diff --git a/src/Magnum/GL/Implementation/ShaderProgramState.cpp b/src/Magnum/GL/Implementation/ShaderProgramState.cpp index 1ca259ff8..e22fc5190 100644 --- a/src/Magnum/GL/Implementation/ShaderProgramState.cpp +++ b/src/Magnum/GL/Implementation/ShaderProgramState.cpp @@ -35,6 +35,8 @@ namespace Magnum { namespace GL { namespace Implementation { +using namespace Containers::Literals; + ShaderProgramState::ShaderProgramState(Context& context, std::vector& extensions): current(0), maxVertexAttributes(0) #ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_WEBGL @@ -52,7 +54,7 @@ ShaderProgramState::ShaderProgramState(Context& context, std::vector&): maxVertexOutputComponents{}, maxFragmentInputComponents{}, #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) @@ -49,7 +51,7 @@ ShaderState::ShaderState(Context& context, std::vector&): #endif { #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; } else #endif @@ -58,7 +60,7 @@ ShaderState::ShaderState(Context& context, std::vector&): } #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; } else #endif diff --git a/src/Magnum/GL/Implementation/TextureState.cpp b/src/Magnum/GL/Implementation/TextureState.cpp index a0502c123..f96b2987a 100644 --- a/src/Magnum/GL/Implementation/TextureState.cpp +++ b/src/Magnum/GL/Implementation/TextureState.cpp @@ -41,6 +41,8 @@ namespace Magnum { namespace GL { namespace Implementation { +using namespace Containers::Literals; + TextureState::TextureState(Context& context, std::vector& extensions): maxSize{}, #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) max3DSize{}, @@ -83,7 +85,7 @@ TextureState::TextureState(Context& context, std::vector& extension #ifdef CORRADE_TARGET_WINDOWS 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; bindImplementation = &AbstractTexture::bindImplementationDSAIntelWindows; @@ -185,11 +187,11 @@ TextureState::TextureState(Context& context, std::vector& extension if(context.isExtensionSupported()) { #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; cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDefault; 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 */ getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDSA; cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDefault; @@ -257,14 +259,14 @@ TextureState::TextureState(Context& context, std::vector& extension /* Compressed cubemap image size query implementation (extensions added above) */ 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()) getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSANonImmutableWorkaround; else getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDefaultImmutableWorkaround; } else if(context.isExtensionSupported() #ifdef CORRADE_TARGET_WINDOWS && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || - context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps")) + context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"_s)) #endif ) { getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSA; @@ -308,7 +310,7 @@ TextureState::TextureState(Context& context, std::vector& extension above) */ if((context.detectedDriver() & Context::DetectedDriver::NVidia) && context.isExtensionSupported() && - !context.isDriverWorkaroundDisabled("nv-cubemap-broken-full-compressed-image-query")) + !context.isDriverWorkaroundDisabled("nv-cubemap-broken-full-compressed-image-query"_s)) getFullCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDSASingleSliceWorkaround; else getFullCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDSA; @@ -318,11 +320,11 @@ TextureState::TextureState(Context& context, std::vector& extension linux as well, test */ if((context.detectedDriver() & Context::DetectedDriver::Amd) && context.isExtensionSupported() && - !context.isDriverWorkaroundDisabled("amd-windows-cubemap-image3d-slice-by-slice")) + !context.isDriverWorkaroundDisabled("amd-windows-cubemap-image3d-slice-by-slice"_s)) getFullCubeImageImplementation = &CubeMapTexture::getImageImplementationDSAAmdSliceBySlice; else if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && context.isExtensionSupported() && - !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps")) + !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"_s)) getFullCubeImageImplementation = &CubeMapTexture::getImageImplementationSliceBySlice; else #endif @@ -426,7 +428,7 @@ TextureState::TextureState(Context& context, std::vector& extension #ifndef MAGNUM_TARGET_GLES /* NVidia workaround for compressed block data size implementation */ 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; else compressedBlockDataSizeImplementation = &AbstractTexture::compressedBlockDataSizeImplementationDefault; @@ -436,7 +438,7 @@ TextureState::TextureState(Context& context, std::vector& extension /* SVGA3D workaround for array / 3D / cube map texture upload. Overrides the DSA / non-DSA function pointers set above. */ 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 image2DImplementation = &AbstractTexture::imageImplementationSvga3DSliceBySlice; #endif @@ -470,21 +472,21 @@ TextureState::TextureState(Context& context, std::vector& extension /* SVGA3D and Intel workaround for cube map texture upload. Overrides the DSA / non-DSA function pointers set above. */ 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()) { cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationDSASliceBySlice; } else { cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationSliceBySlice; } } 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; } #ifdef CORRADE_TARGET_WINDOWS /** @todo those *might* be happening with the proprietary AMD driver on linux as well, test */ 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 emulate using classic APIs */ cubeSubImage3DImplementation = &CubeMapTexture::subImageImplementationSliceBySlice; @@ -504,7 +506,7 @@ TextureState::TextureState(Context& context, std::vector& extension bindings = Containers::Array>{Containers::ValueInit, std::size_t(maxTextureUnits)}; #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); /* Assume ARB_multi_bind is not supported, otherwise we'd need to implement the workaround also for bindMultiImplementation */ diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index 3115e49c2..0fcd147c7 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -49,6 +49,8 @@ namespace Magnum { namespace Platform { +using namespace Containers::Literals; + #ifdef GLFW_TRUE /* 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"); @@ -532,7 +534,7 @@ bool GlfwApplication::tryCreate(const Configuration& configuration, const GLConf std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 0 || #endif std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) - && !_context->isDriverWorkaroundDisabled("no-forward-compatible-core-context")) + && !_context->isDriverWorkaroundDisabled("no-forward-compatible-core-context"_s)) #endif )) { /* Don't print any warning when doing the workaround, because the bug diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index aed91cacb..ccec3f2d3 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -69,6 +69,8 @@ namespace Magnum { namespace Platform { +using namespace Containers::Literals; + namespace { /* @@ -560,7 +562,7 @@ bool Sdl2Application::tryCreate(const Configuration& configuration, const GLConf std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 0 || #endif std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) - && !_context->isDriverWorkaroundDisabled("no-forward-compatible-core-context")) + && !_context->isDriverWorkaroundDisabled("no-forward-compatible-core-context"_s)) #endif )) { /* Don't print any warning when doing the workaround, because the bug diff --git a/src/Magnum/Platform/WindowlessEglApplication.cpp b/src/Magnum/Platform/WindowlessEglApplication.cpp index 6a6462e47..41b2e5faa 100644 --- a/src/Magnum/Platform/WindowlessEglApplication.cpp +++ b/src/Magnum/Platform/WindowlessEglApplication.cpp @@ -72,6 +72,8 @@ typedef void (APIENTRY *EGLDEBUGPROCKHR)(EGLenum error, const char* command, EGL namespace Magnum { namespace Platform { +using namespace Containers::Literals; + #ifndef MAGNUM_TARGET_WEBGL namespace { @@ -190,7 +192,7 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G well-behaved driver versions, eglQueryDeviceAttribEXT() returns false instead of segfaulting. */ 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; 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 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 */ - 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]; CORRADE_INTERNAL_ASSERT(contextFlags == EGL_CONTEXT_FLAGS_KHR); contextFlags = EGL_NONE; @@ -399,7 +401,7 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G strncmp() */ if(vendorString && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 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 */ eglDestroyContext(_display, _context); @@ -430,7 +432,7 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) /* SwiftShader 3.3.0.1 needs some pbuffer, otherwise it crashes somewhere 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[] = { EGL_WIDTH, 32, EGL_HEIGHT, 32, diff --git a/src/Magnum/Platform/WindowlessGlxApplication.cpp b/src/Magnum/Platform/WindowlessGlxApplication.cpp index 9226476bc..e010ef495 100644 --- a/src/Magnum/Platform/WindowlessGlxApplication.cpp +++ b/src/Magnum/Platform/WindowlessGlxApplication.cpp @@ -39,6 +39,8 @@ namespace { enum { None = 0, Success = 0 }; } namespace Magnum { namespace Platform { +using namespace Containers::Literals; + namespace { /* @@ -188,7 +190,7 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura strncmp() */ if(vendorString && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 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 */ glXDestroyContext(_display, _context); diff --git a/src/Magnum/Platform/WindowlessWglApplication.cpp b/src/Magnum/Platform/WindowlessWglApplication.cpp index 0d9c2cbb5..2dd1bbc29 100644 --- a/src/Magnum/Platform/WindowlessWglApplication.cpp +++ b/src/Magnum/Platform/WindowlessWglApplication.cpp @@ -46,6 +46,8 @@ namespace Magnum { namespace Platform { +using namespace Containers::Literals; + WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, GLContext* const magnumContext) { /* Register the window class (if not yet done) */ WNDCLASSW wc; @@ -188,7 +190,7 @@ WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, G if(vendorString && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 || std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 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 */ wglDeleteContext(_context); diff --git a/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp b/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp index 76fffe8e7..89a9b0f05 100644 --- a/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp +++ b/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp @@ -42,12 +42,14 @@ void flextGLInit(Magnum::GL::Context& context) { #ifdef MAGNUM_PLATFORM_USE_EGL { + using namespace Corrade::Containers::Literals; + /* 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 to retrieve them explicitly using eglGetProcAddress(). */ EGLDisplay display = eglGetCurrentDisplay(); 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 */ flextGL.BlendFunc = reinterpret_cast(loader.load("glBlendFunc")); diff --git a/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp.template b/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp.template index 6fe6080e7..78f9cb082 100644 --- a/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp.template +++ b/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp.template @@ -43,12 +43,14 @@ void flextGLInit(Magnum::GL::Context& context) { #ifdef MAGNUM_PLATFORM_USE_EGL { + using namespace Corrade::Containers::Literals; + /* 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 to retrieve them explicitly using eglGetProcAddress(). */ EGLDisplay display = eglGetCurrentDisplay(); 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: @if funcs and category in ['VERSION_1_0', 'VERSION_1_1']: