Functions module_functions_;
- // We are using vector to map the ID of the capability to its availability.
- // The size of the vector needs to be the maximum ID plus one to cover the
- // entire range of the capability.
- std::vector<bool> module_capabilities_;
+ spv_capability_mask_t module_capabilities_; // Module's declared capabilities.
// Definitions and uses of all the IDs in the module.
UseDefTracker usedefs_;
operand_names_{},
current_layout_section_(kLayoutCapabilities),
module_functions_(*this),
- module_capabilities_(kCapabilitiesMaxValue + 1, false),
+ module_capabilities_(0u),
grammar_(context) {}
spv_result_t ValidationState_t::forwardDeclareId(uint32_t id) {
}
void ValidationState_t::registerCapability(SpvCapability cap) {
- module_capabilities_[cap] = true;
+ module_capabilities_ |= SPV_CAPABILITY_AS_MASK(cap);
spv_operand_desc desc;
if (SPV_SUCCESS ==
grammar_.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, cap, &desc))
}
bool ValidationState_t::hasCapability(SpvCapability cap) const {
- return module_capabilities_[cap];
+ return module_capabilities_ & SPV_CAPABILITY_AS_MASK(cap);
}
bool ValidationState_t::HasAnyOf(spv_capability_mask_t capabilities) const {