Skip to content

Commit

Permalink
Initial capability implementation and unit tests
Browse files Browse the repository at this point in the history
* Register capabilility and checks
* Add validate storage class capabilities checks and tests
* Instruction pass refactor
  - More generic form of capability checking by checking operands
    instead of instructions
* Execution Model capabilities checks
* Decorate BuiltIn capability checks
* Addressing Model capability checks
* Memory Model capability checks
* Execution Mode capability checks
* Dim capability checks
* SamplerAddressingMode capability checks
  • Loading branch information
umar456 committed Jan 27, 2016
1 parent 3fade33 commit 61a6275
Show file tree
Hide file tree
Showing 7 changed files with 1,385 additions and 13 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES})
${CMAKE_CURRENT_SOURCE_DIR}/test/TextWordGet.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/UnitSPIRV.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/ValidateFixtures.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/Validate.Capability.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/Validate.Layout.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/Validate.SSA.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/ValidateID.cpp
Expand Down
1 change: 1 addition & 0 deletions include/libspirv/libspirv.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ typedef enum spv_result_t {
SPV_ERROR_INVALID_ID = -10,
SPV_ERROR_INVALID_CFG = -11,
SPV_ERROR_INVALID_LAYOUT = -12,
SPV_ERROR_INVALID_CAPABILITY = -13,
SPV_FORCE_32_BIT_ENUM(spv_result_t)
} spv_result_t;

Expand Down
9 changes: 8 additions & 1 deletion source/validate.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ class ValidationState_t {
std::vector<uint32_t>& entry_points() { return entry_points_; }
const std::vector<uint32_t>& entry_points() const { return entry_points_; }

// Registers the capability and its dependent capabilities
void registerCapability(SpvCapability cap);

// Returns true if the capabillity is enabled in the module
bool hasCapability(SpvCapability cap);

private:
spv_diagnostic* diagnostic_;
// Tracks the number of instructions evaluated by the validator
Expand All @@ -279,13 +285,14 @@ class ValidationState_t {

Functions module_functions_;

std::vector<SpvCapability> module_capabilities_;
std::vector<bool> module_capabilities_;

// Definitions and uses of all the IDs in the module.
UseDefTracker usedefs_;

// IDs that are entry points, ie, arguments to OpEntryPoint.
std::vector<uint32_t> entry_points_;

};

} // namespace libspirv
Expand Down
Loading

0 comments on commit 61a6275

Please sign in to comment.