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 {
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<std::string>& extensions)
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#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<std::string>& extensions)
#ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>() &&
(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<std::string>& 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<std::string>& 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;

4
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<std::string>&) {
#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;

16
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<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
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
#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<std::string>& e
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#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<std::string>& e
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#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<std::string>& 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<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 */
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 {

8
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<std::string>& 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<s
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#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<s
/* Intel Windows drivers are ... special */
#ifdef CORRADE_TARGET_WINDOWS
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;
} else
@ -328,7 +330,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, std::vector<s
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#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;

8
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<std::string>& extensions) {
/* Create implementation */
#ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
#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 {

4
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<std::string>& 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

8
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<std::string>& extensions): current(0), maxVertexAttributes(0)
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_WEBGL
@ -52,7 +54,7 @@ ShaderProgramState::ShaderProgramState(Context& context, std::vector<std::string
#ifndef MAGNUM_TARGET_GLES2
#ifdef CORRADE_TARGET_WINDOWS
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;
} else
@ -63,12 +65,12 @@ ShaderProgramState::ShaderProgramState(Context& context, std::vector<std::string
#endif
#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;
} else
#endif
#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;
} else
#endif

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

@ -34,6 +34,8 @@
namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
ShaderState::ShaderState(Context& context, std::vector<std::string>&):
maxVertexOutputComponents{}, maxFragmentInputComponents{},
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
@ -49,7 +51,7 @@ ShaderState::ShaderState(Context& context, std::vector<std::string>&):
#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<std::string>&):
}
#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

30
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<std::string>& extensions): maxSize{},
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
max3DSize{},
@ -83,7 +85,7 @@ TextureState::TextureState(Context& context, std::vector<std::string>& 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<std::string>& extension
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
#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<std::string>& 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<Extensions::ARB::direct_state_access>())
getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSANonImmutableWorkaround;
else getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDefaultImmutableWorkaround;
} else if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#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<std::string>& extension
above) */
if((context.detectedDriver() & Context::DetectedDriver::NVidia) &&
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;
else
getFullCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDSA;
@ -318,11 +320,11 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
linux as well, test */
if((context.detectedDriver() & Context::DetectedDriver::Amd) &&
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;
else if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) &&
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;
else
#endif
@ -426,7 +428,7 @@ TextureState::TextureState(Context& context, std::vector<std::string>& 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<std::string>& 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<std::string>& 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<Extensions::ARB::direct_state_access>()) {
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<std::string>& extension
bindings = Containers::Array<std::pair<GLenum, GLuint>>{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 */

4
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

4
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

10
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,

4
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);

4
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);

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

@ -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<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
{
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']:

Loading…
Cancel
Save