mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-13 09:50:06 +00:00
Eliminate kCapabilitiesMin/Max.
This commit is contained in:
parent
59436bb6b7
commit
a9f36d0143
@ -45,19 +45,12 @@ typedef uint64_t spv_capability_mask_t;
|
||||
#define SPV_CAPABILITY_AS_MASK(capability) \
|
||||
(spv_capability_mask_t(1) << (capability))
|
||||
|
||||
// Min/max capability IDs. TODO(dekimir): move this into context.
|
||||
enum {
|
||||
kCapabilitiesMinValue = SpvCapabilityMatrix,
|
||||
kCapabilitiesMaxValue = SpvCapabilityPipeStorage
|
||||
};
|
||||
|
||||
// Applies f to every capability present in a mask.
|
||||
namespace libspirv {
|
||||
template <typename Functor>
|
||||
inline void ForEach(spv_capability_mask_t capabilities, Functor f) {
|
||||
for (int cap = kCapabilitiesMinValue; cap <= kCapabilitiesMaxValue; ++cap)
|
||||
if (spvIsInBitfield(SPV_CAPABILITY_AS_MASK(cap), capabilities))
|
||||
f(static_cast<SpvCapability>(cap));
|
||||
for (int c = 0; capabilities; ++c, capabilities >>= 1)
|
||||
if (capabilities & 1) f(static_cast<SpvCapability>(c));
|
||||
}
|
||||
} // end namespace libspirv
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user