From: Dejan Mircevski Date: Fri, 22 Apr 2016 17:35:15 +0000 (-0400) Subject: Turn module_capabilities_ into a spv_capability_mask_t. X-Git-Tag: upstream/2018.6~1259 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59436bb6b7d911ddf0908ba3cf4012e8ea3f440e;p=platform%2Fupstream%2FSPIRV-Tools.git Turn module_capabilities_ into a spv_capability_mask_t. --- diff --git a/source/validate.h b/source/validate.h index 77bf9c2..972916f 100644 --- a/source/validate.h +++ b/source/validate.h @@ -289,10 +289,7 @@ class ValidationState_t { 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 module_capabilities_; + spv_capability_mask_t module_capabilities_; // Module's declared capabilities. // Definitions and uses of all the IDs in the module. UseDefTracker usedefs_; diff --git a/source/validate_types.cpp b/source/validate_types.cpp index add47d3..894e530 100644 --- a/source/validate_types.cpp +++ b/source/validate_types.cpp @@ -217,7 +217,7 @@ ValidationState_t::ValidationState_t(spv_diagnostic* diagnostic, 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) { @@ -295,7 +295,7 @@ bool ValidationState_t::in_block() const { } 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)) @@ -304,7 +304,7 @@ void ValidationState_t::registerCapability(SpvCapability cap) { } 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 {