diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-03-30 19:23:09 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-30 23:23:09 +0000 |
| commit | ea7690558bca71ce3a9453adff4e0135352a352f (patch) | |
| tree | 3eb983d3f8e6b1c215f6d2818a0f3e793ecb4485 /source/core/slang-semantic-version.h | |
| parent | ad5b60c8b5868c69a979779f201748fb7837fdc9 (diff) | |
CUDA version handling (#1301)
* render feature for CUDA compute model.
* Use SemanticVersion type.
* Enable CUDA wave tests that require CUDA SM 7.0.
Provide mechanism for DownstreamCompiler to specify version numbers.
* Enabled wave-equality.slang
* Make CUDA SM version major version not just a single digit.
* Fix assert.
* DownstreamCompiler::Version -> CapabilityVersion
Diffstat (limited to 'source/core/slang-semantic-version.h')
| -rw-r--r-- | source/core/slang-semantic-version.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/source/core/slang-semantic-version.h b/source/core/slang-semantic-version.h index bbfcb663e..d33116de6 100644 --- a/source/core/slang-semantic-version.h +++ b/source/core/slang-semantic-version.h @@ -15,9 +15,9 @@ struct SemanticVersion 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)) + m_major(uint32_t(inMajor)), + m_minor(uint16_t(inMinor)), + m_patch(uint16_t(inPatch)) {} void reset() @@ -27,15 +27,26 @@ struct SemanticVersion m_patch = 0; } + /// All zeros means nothing is set + bool isSet() const { return m_major || m_minor || m_patch; } + 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); + set(int(v >> 32), int((v >> 16) & 0xffff), int(v & 0xffff)); + } + void set(int major, int minor, int patch = 0) + { + SLANG_ASSERT(major >= 0 && minor >=0 && patch >= 0); + + m_major = uint32_t(major); + m_minor = uint16_t(minor); + m_patch = uint16_t(patch); } static SlangResult parse(const UnownedStringSlice& value, SemanticVersion& outVersion); + static SlangResult parse(const UnownedStringSlice& value, char separatorChar, SemanticVersion& outVersion); + void append(StringBuilder& buf) const; bool operator>(const ThisType& rhs) const { return toInteger() > rhs.toInteger(); } |
