mirror of https://github.com/mosra/magnum.git
Browse Source
With DSA there is slightly different (but completely understandable) usage -- it's needed to specify the target upon creation, not deferring it to begin() call. Timestamp queries (TimeQuery::timestamp()) must now also be created with new TimeQuery::Target::Timestamp target. The old way (parameterless constructor and begin(Target)) is still supported, but is marked as deprecated and will be removed in future release. Also, using the old way the DSA function is simply not used. Also fixed SampleQuery test to account for cases where the driver might not support ARB_occlusion_query2.pull/71/head
14 changed files with 304 additions and 69 deletions
@ -0,0 +1,52 @@
|
||||
/*
|
||||
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 "QueryState.h" |
||||
|
||||
#include "Magnum/Context.h" |
||||
#include "Magnum/Extensions.h" |
||||
|
||||
namespace Magnum { namespace Implementation { |
||||
|
||||
QueryState::QueryState(Context& context, std::vector<std::string>& extensions) { |
||||
/* Create implementation */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
if(context.isExtensionSupported<Extensions::GL::ARB::direct_state_access>()) { |
||||
extensions.push_back(Extensions::GL::ARB::direct_state_access::string()); |
||||
createImplementation = &AbstractQuery::createImplementationDSA; |
||||
|
||||
} else |
||||
#endif |
||||
{ |
||||
createImplementation = &AbstractQuery::createImplementationDefault; |
||||
} |
||||
|
||||
#ifdef MAGNUM_TARGET_GLES |
||||
static_cast<void>(context); |
||||
static_cast<void>(extensions); |
||||
#endif |
||||
} |
||||
|
||||
}} |
||||
@ -0,0 +1,44 @@
|
||||
#ifndef Magnum_Implementation_QueryState_h |
||||
#define Magnum_Implementation_QueryState_h |
||||
/*
|
||||
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 <vector> |
||||
|
||||
#include "Magnum/AbstractQuery.h" |
||||
|
||||
namespace Magnum { namespace Implementation { |
||||
|
||||
struct QueryState { |
||||
explicit QueryState(Context& context, std::vector<std::string>& extensions); |
||||
|
||||
void reset(); |
||||
|
||||
void(AbstractQuery::*createImplementation)(); |
||||
}; |
||||
|
||||
}} |
||||
|
||||
#endif |
||||
Loading…
Reference in new issue