diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-03-05 10:59:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-05 10:59:54 -0500 |
| commit | 6684d32db1f5693bcfb4971558cb30e855cd3bad (patch) | |
| tree | 480e014b917a6eb0fe72faa6c52a25f4856ed1cb /source/core/slang-semantic-version.h | |
| parent | 5951d2a45f3546a619fb5b032a4a422229c46e4c (diff) | |
Feature/glslang spirv version (#1256)
* WIP add support for __spirv_version .
* Added IRRequireSPIRVVersionDecoration
* SPIR-V version passed to glslang.
Enable VK wave tests.
Split ExtensionTracker out, so can be cast and used externally to emit.
Added SourceResult.
* Fix warning on Clang.
* Missing hlsl.meta.h
* Refactor communication/parsing of __spirv_version with glslang.
* Fix some debug typos.
Be more precise in handling of substring handling.
* Make glslang forwards and backwards binary compatible.
* Small comment improvements.
* Added slang-spirv-target-info.h/cpp
* Fix for major/minor on gcc.
* Another fix for gcc/clang.
* VS projects include slang-spirv-target-info.h/cpp
* Removed SPIRVTargetInfo
Added SemanticVersion.
Don't bother with passing a target to glslang. Should be separate from 'version'.
* Renamed slang-emit-glsl-extension-tracker.cpp/.h -> slang-glsl-extension-tracker.cpp/.h
Fixed some VS project issues.
* Fix a comment.
* Added slang-semantic-version.cpp/.h
* Added slang-glsl-extension-tracker.cpp/.h
* Added split that can check for input has all been parsed.
* Fix problem on x86 win build.
Diffstat (limited to 'source/core/slang-semantic-version.h')
| -rw-r--r-- | source/core/slang-semantic-version.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/source/core/slang-semantic-version.h b/source/core/slang-semantic-version.h new file mode 100644 index 000000000..bbfcb663e --- /dev/null +++ b/source/core/slang-semantic-version.h @@ -0,0 +1,56 @@ +// slang-semantic-version.h +#ifndef SLANG_SEMANTIC_VERSION_H +#define SLANG_SEMANTIC_VERSION_H + +#include "../core/slang-basic.h" + +namespace Slang +{ + +struct SemanticVersion +{ + typedef SemanticVersion ThisType; + + typedef uint64_t IntegerType; + + SemanticVersion():m_major(0), m_minor(0), m_patch(0) {} + SemanticVersion(int inMajor, int inMinor = 0, int inPatch = 0): + m_major(uint8_t(inMajor)), + m_minor(uint8_t(inMinor)), + m_patch(uint8_t(inPatch)) + {} + + void reset() + { + m_major = 0; + m_minor = 0; + m_patch = 0; + } + + IntegerType toInteger() const { return (IntegerType(m_major) << 32) | (uint32_t(m_minor) << 16) | m_patch; } + void setFromInteger(IntegerType v) + { + m_major = (v >> 32); + m_minor = uint16_t(v >> 16); + m_patch = uint16_t(v); + } + + static SlangResult parse(const UnownedStringSlice& value, SemanticVersion& outVersion); + void append(StringBuilder& buf) const; + + bool operator>(const ThisType& rhs) const { return toInteger() > rhs.toInteger(); } + bool operator>=(const ThisType& rhs) const { return toInteger() >= rhs.toInteger(); } + + bool operator<(const ThisType& rhs) const { return toInteger() < rhs.toInteger(); } + bool operator<=(const ThisType& rhs) const { return toInteger() <= rhs.toInteger(); } + + bool operator==(const ThisType& rhs) const { return toInteger() == rhs.toInteger(); } + bool operator!=(const ThisType& rhs) const { return toInteger() != rhs.toInteger(); } + + uint32_t m_major; + uint16_t m_minor; + uint16_t m_patch; +}; + +} +#endif |
