mirror of https://github.com/mosra/magnum.git
Browse Source
Previously the extensions were either disabled altogether (e.g. because we don't have yet extension wrangler on ES) or had manually adjusted minimal required versions to avoid issues on older versions (e.g. ARB_explicit_attrib_location is known to give compiler errors when used with GLSL < 1.50 on some drivers), both done basically at compile time unrelated to actual hardware/driver used. Now all the extensions are enabled exactly as the driver advertises them (or when their core version is not larger than the context version) and have minimal required versions as per specification. Given extension is supported in given version when it is marked as such and its minimal required version is not larger than the requested one. The extension disabling is thus done by simply increasing the minimal required version to larger value (or Version::None for disabling it for all versions). Currently no such disabling is put into place, but the existing workarounds scattered all over the place will be gradually converted to this. Simplified the code and tests by marking all extensions from previous versions as supported instead of additional "shorthand" checking whether extension's core version is supported. The check wasn't probably much of a speedup, as it was just another branch. This was also buggy previously, because when the extension would be reported as not being supported in older versions, which is not what we want. Hopefully this won't reintroduce the numerous issues with Mesa and OSX I had in the past :-) Also removed duplicate implementation of Context::isExtensionSupported(), one overload is now calling the other.pull/51/head
4 changed files with 66 additions and 5 deletions
@ -0,0 +1,39 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014 |
||||
Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Magnum/Context.h" |
||||
#include "Magnum/Extensions.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
void Context::setupDriverWorkarounds() { |
||||
#define _setRequiredVersion(extension, version) \ |
||||
if(_extensionRequiredVersion[Extensions::extension::Index] < Version::version) \
|
||||
_extensionRequiredVersion[Extensions::extension::Index] = Version::version |
||||
|
||||
#undef _setRequiredVersion |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue