diff options
Diffstat (limited to 'source/val/validation_state.h')
-rw-r--r-- | source/val/validation_state.h | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/source/val/validation_state.h b/source/val/validation_state.h index 4d5ac006..1b599ff3 100644 --- a/source/val/validation_state.h +++ b/source/val/validation_state.h @@ -185,10 +185,10 @@ class ValidationState_t { void ProgressToNextLayoutSectionOrder(); /// Determines if the op instruction is in a previous layout section - bool IsOpcodeInPreviousLayoutSection(spv::Op op); + bool IsOpcodeInPreviousLayoutSection(SpvOp op); /// Determines if the op instruction is part of the current section - bool IsOpcodeInCurrentLayoutSection(spv::Op op); + bool IsOpcodeInCurrentLayoutSection(SpvOp op); DiagnosticStream diag(spv_result_t error_code, const Instruction* inst); @@ -217,8 +217,7 @@ class ValidationState_t { }; /// Registers |id| as an entry point with |execution_model| and |interfaces|. - void RegisterEntryPoint(const uint32_t id, - spv::ExecutionModel execution_model, + void RegisterEntryPoint(const uint32_t id, SpvExecutionModel execution_model, EntryPointDescription&& desc) { entry_points_.push_back(id); entry_point_to_execution_models_[id].insert(execution_model); @@ -236,7 +235,7 @@ class ValidationState_t { /// Registers execution mode for the given entry point. void RegisterExecutionModeForEntryPoint(uint32_t entry_point, - spv::ExecutionMode execution_mode) { + SpvExecutionMode execution_mode) { entry_point_to_execution_modes_[entry_point].insert(execution_mode); } @@ -248,7 +247,7 @@ class ValidationState_t { /// Returns Execution Models for the given Entry Point. /// Returns nullptr if none found (would trigger assertion). - const std::set<spv::ExecutionModel>* GetExecutionModels( + const std::set<SpvExecutionModel>* GetExecutionModels( uint32_t entry_point) const { const auto it = entry_point_to_execution_models_.find(entry_point); if (it == entry_point_to_execution_models_.end()) { @@ -260,7 +259,7 @@ class ValidationState_t { /// Returns Execution Modes for the given Entry Point. /// Returns nullptr if none found. - const std::set<spv::ExecutionMode>* GetExecutionModes( + const std::set<SpvExecutionMode>* GetExecutionModes( uint32_t entry_point) const { const auto it = entry_point_to_execution_modes_.find(entry_point); if (it == entry_point_to_execution_modes_.end()) { @@ -301,7 +300,7 @@ class ValidationState_t { return (id_to_function_.find(id) != id_to_function_.end()); } /// Registers the capability and its dependent capabilities - void RegisterCapability(spv::Capability cap); + void RegisterCapability(SpvCapability cap); /// Registers the extension. void RegisterExtension(Extension ext); @@ -309,14 +308,14 @@ class ValidationState_t { /// Registers the function in the module. Subsequent instructions will be /// called against this function spv_result_t RegisterFunction(uint32_t id, uint32_t ret_type_id, - spv::FunctionControlMask function_control, + SpvFunctionControlMask function_control, uint32_t function_type_id); /// Register a function end instruction spv_result_t RegisterFunctionEnd(); /// Returns true if the capability is enabled in the module. - bool HasCapability(spv::Capability cap) const { + bool HasCapability(SpvCapability cap) const { return module_capabilities_.Contains(cap); } @@ -340,16 +339,16 @@ class ValidationState_t { bool HasAnyOfExtensions(const ExtensionSet& extensions) const; /// Sets the addressing model of this module (logical/physical). - void set_addressing_model(spv::AddressingModel am); + void set_addressing_model(SpvAddressingModel am); /// Returns true if the OpMemoryModel was found. bool has_memory_model_specified() const { - return addressing_model_ != spv::AddressingModel::Max && - memory_model_ != spv::MemoryModel::Max; + return addressing_model_ != SpvAddressingModelMax && + memory_model_ != SpvMemoryModelMax; } /// Returns the addressing model of this module, or Logical if uninitialized. - spv::AddressingModel addressing_model() const; + SpvAddressingModel addressing_model() const; /// Returns the addressing model of this module, or Logical if uninitialized. uint32_t pointer_size_and_alignment() const { @@ -357,10 +356,10 @@ class ValidationState_t { } /// Sets the memory model of this module. - void set_memory_model(spv::MemoryModel mm); + void set_memory_model(SpvMemoryModel mm); /// Returns the memory model of this module, or Simple if uninitialized. - spv::MemoryModel memory_model() const; + SpvMemoryModel memory_model() const; /// Sets the bit width for sampler/image type variables. If not set, they are /// considered opaque @@ -433,8 +432,8 @@ class ValidationState_t { // The decorations are sorted by member_index, so this look up will give the // exact range of decorations for this member index. - Decoration min_decoration((spv::Decoration)0, {}, member_index); - Decoration max_decoration(spv::Decoration::Max, {}, member_index); + Decoration min_decoration((SpvDecoration)0, {}, member_index); + Decoration max_decoration(SpvDecorationMax, {}, member_index); FieldDecorationsIter result; result.begin = decorations.lower_bound(min_decoration); @@ -450,7 +449,7 @@ class ValidationState_t { /// Returns true if the given id <id> has the given decoration <dec>, /// otherwise returns false. - bool HasDecoration(uint32_t id, spv::Decoration dec) { + bool HasDecoration(uint32_t id, SpvDecoration dec) { const auto& decorations = id_decorations_.find(id); if (decorations == id_decorations_.end()) return false; @@ -486,7 +485,7 @@ class ValidationState_t { Instruction* consumer); // Record a function's storage class consumer instruction - void RegisterStorageClassConsumer(spv::StorageClass storage_class, + void RegisterStorageClassConsumer(SpvStorageClass storage_class, Instruction* consumer); /// Returns the set of Global Variables. @@ -617,7 +616,7 @@ class ValidationState_t { // Returns true if |id| is a type id that contains |type| (or integer or // floating point type) of |width| bits. - bool ContainsSizedIntOrFloatType(uint32_t id, spv::Op type, + bool ContainsSizedIntOrFloatType(uint32_t id, SpvOp type, uint32_t width) const; // Returns true if |id| is a type id that contains a 8- or 16-bit int or // 16-bit float that is not generally enabled for use. @@ -643,7 +642,7 @@ class ValidationState_t { // Returns opcode of the instruction which issued the id or OpNop if the // instruction is not registered. - spv::Op GetIdOpcode(uint32_t id) const; + SpvOp GetIdOpcode(uint32_t id) const; // Returns type_id for given id operand if it has a type or zero otherwise. // |operand_index| is expected to be pointing towards an operand which is an @@ -653,7 +652,7 @@ class ValidationState_t { // Provides information on pointer type. Returns false iff not pointer type. bool GetPointerTypeInfo(uint32_t id, uint32_t* data_type, - spv::StorageClass* storage_class) const; + uint32_t* storage_class) const; // Is the ID the type of a pointer to a uniform block: Block-decorated struct // in uniform storage class? The result is only valid after internal method @@ -733,9 +732,6 @@ class ValidationState_t { } return std::string(desc->name); } - std::string SpvDecorationString(spv::Decoration decoration) { - return SpvDecorationString(uint32_t(decoration)); - } // Returns whether type m1 and type m2 are cooperative matrices with // the same "shape" (matching scope, rows, cols). If any are specialization @@ -768,7 +764,7 @@ class ValidationState_t { const Instruction* TracePointer(const Instruction* inst) const; // Validates the storage class for the target environment. - bool IsValidStorageClass(spv::StorageClass storage_class) const; + bool IsValidStorageClass(SpvStorageClass storage_class) const; // Takes a Vulkan Valid Usage ID (VUID) as |id| and optional |reference| and // will return a non-empty string only if ID is known and targeting Vulkan. @@ -887,8 +883,8 @@ class ValidationState_t { AssemblyGrammar grammar_; - spv::AddressingModel addressing_model_; - spv::MemoryModel memory_model_; + SpvAddressingModel addressing_model_; + SpvMemoryModel memory_model_; // pointer size derived from addressing model. Assumes all storage classes // have the same pointer size (for physical pointer types). uint32_t pointer_size_and_alignment_; @@ -909,11 +905,11 @@ class ValidationState_t { /// Mapping entry point -> execution models. It is presumed that the same /// function could theoretically be used as 'main' by multiple OpEntryPoint /// instructions. - std::unordered_map<uint32_t, std::set<spv::ExecutionModel>> + std::unordered_map<uint32_t, std::set<SpvExecutionModel>> entry_point_to_execution_models_; /// Mapping entry point -> execution modes. - std::unordered_map<uint32_t, std::set<spv::ExecutionMode>> + std::unordered_map<uint32_t, std::set<SpvExecutionMode>> entry_point_to_execution_modes_; /// Mapping function -> array of entry points inside this |