diff --git a/doc/changelog.dox b/doc/changelog.dox index 42c9e1d4e..cc8f4a392 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -188,9 +188,14 @@ See also: - @cpp "intel-windows-broken-dsa-integer-vertex-attributes" @ce fixing @ref GL::Mesh::addVertexBuffer() with @ref Magnum::Short "Short" attributes -- New @cpp "amd-windows-cubemap-image3d-slice-by-slice" @ce workaround for - broken handling of cube map image download and upload in DSA APIs on AMD - Windows drivers +- New AMD Windows driver workarounds, related to + @gl_extension{ARB,direct_state_access} as well --- see + @ref opengl-workarounds for more information: + - @cpp "amd-windows-cubemap-image3d-slice-by-slice" @ce for broken + handling of cube map image download and upload in DSA APIs + - @cpp "amd-windows-dsa-createquery-except-xfb-overflow" @ce using a + non-DSA code path for creating + @ref PrimitiveQuery::Target::TransformFeedbackOverflow queries - New @cpp "arm-mali-timer-queries-oom-in-shell" @ce workaround for @ref GL::Context::DetectedDriver::ArmMali "ARM Mali" drivers on Android disabling the @gl_extension{EXT,disjoint_timer_query} extension in Android diff --git a/src/Magnum/GL/AbstractQuery.cpp b/src/Magnum/GL/AbstractQuery.cpp index 3ef51876c..2ff831238 100644 --- a/src/Magnum/GL/AbstractQuery.cpp +++ b/src/Magnum/GL/AbstractQuery.cpp @@ -64,6 +64,13 @@ void AbstractQuery::createImplementationDefault() { void AbstractQuery::createImplementationDSA() { glCreateQueries(_target, 1, &_id); } + +void AbstractQuery::createImplementationDSAExceptXfbOverflow() { + if(_target == GL_TRANSFORM_FEEDBACK_OVERFLOW || _target == GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW) + createImplementationDefault(); + else + createImplementationDSA(); +} #endif #ifndef MAGNUM_TARGET_WEBGL diff --git a/src/Magnum/GL/AbstractQuery.h b/src/Magnum/GL/AbstractQuery.h index 2e808602c..8eff1b608 100644 --- a/src/Magnum/GL/AbstractQuery.h +++ b/src/Magnum/GL/AbstractQuery.h @@ -190,6 +190,7 @@ class MAGNUM_GL_EXPORT AbstractQuery: public AbstractObject { void MAGNUM_GL_LOCAL createImplementationDefault(); #ifndef MAGNUM_TARGET_GLES void MAGNUM_GL_LOCAL createImplementationDSA(); + void MAGNUM_GL_LOCAL createImplementationDSAExceptXfbOverflow(); #endif ObjectFlags _flags; diff --git a/src/Magnum/GL/Implementation/QueryState.cpp b/src/Magnum/GL/Implementation/QueryState.cpp index e0d8b30ce..2660b0f82 100644 --- a/src/Magnum/GL/Implementation/QueryState.cpp +++ b/src/Magnum/GL/Implementation/QueryState.cpp @@ -34,15 +34,19 @@ namespace Magnum { namespace GL { namespace Implementation { QueryState::QueryState(Context& context, std::vector& extensions) { /* Create implementation */ #ifndef MAGNUM_TARGET_GLES - if(context.isExtensionSupported() + if(context.isExtensionSupported()) { #ifdef CORRADE_TARGET_WINDOWS - && (!(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")) { + createImplementation = &AbstractQuery::createImplementationDefault; + } else if((context.detectedDriver() & Context::DetectedDriver::Amd) && !context.isDriverWorkaroundDisabled("amd-windows-dsa-createquery-except-xfb-overflow")) { + extensions.emplace_back(Extensions::ARB::direct_state_access::string()); + createImplementation = &AbstractQuery::createImplementationDSAExceptXfbOverflow; + } else #endif - ) { - extensions.emplace_back(Extensions::ARB::direct_state_access::string()); - createImplementation = &AbstractQuery::createImplementationDSA; - + { + extensions.emplace_back(Extensions::ARB::direct_state_access::string()); + createImplementation = &AbstractQuery::createImplementationDSA; + } } else #endif { diff --git a/src/Magnum/GL/Implementation/driverSpecific.cpp b/src/Magnum/GL/Implementation/driverSpecific.cpp index 9463ad4a7..2ec1c9cf4 100644 --- a/src/Magnum/GL/Implementation/driverSpecific.cpp +++ b/src/Magnum/GL/Implementation/driverSpecific.cpp @@ -57,6 +57,12 @@ namespace { download is affected as well, but we lack APIs for easy format-dependent slicing and offset calculation, so those currently still fail. */ "amd-windows-cubemap-image3d-slice-by-slice", + +/* AMD Windows glCreateQueries() works for everything except + GL_TRANSFORM_FEEDBACK_[STREAM_]OVERFLOW, probably they just forgot to adapt + it to this new GL 4.6 addition. Calling the non-DSA code path in that case + instead. */ +"amd-windows-dsa-createquery-except-xfb-overflow", #endif #if !defined(MAGNUM_TARGET_GLES) && !defined(CORRADE_TARGET_APPLE)