summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-impl.h
diff options
context:
space:
mode:
authorTheresa Foley <tfoleyNV@users.noreply.github.com>2021-09-02 16:10:53 -0700
committerGitHub <noreply@github.com>2021-09-02 16:10:53 -0700
commitcf7dddae74ae990c2b46a9feeaea3b7a33ec077d (patch)
treeccd49f5c9661fe3ec621b7ea36528d835bcd9fef /source/slang/slang-check-impl.h
parentcaf46421fcc6792dd2ab991752b6a97b44ba0431 (diff)
Two small fixes. (#1928)
* Fix mangling logic for the case where a symbol name contains characters that aren't permitted (this usually occurs when a module name consists of the actual path to the module). There were multiple early-out `if` cases that accidentally fell through to the fallback path, so that symbol names would end up being excessively long. * Fix type conversion cost lookup cache, by allowing single-element vectors (e.g., `vector<float,1>`) and single row/column matrix types to be distinguished from types of lower rank. Previously, `float` and `float1` and `float1x1` would share a single cache entry, even though each (currently) has very different conversion rules.
Diffstat (limited to 'source/slang/slang-check-impl.h')
-rw-r--r--source/slang/slang-check-impl.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h
index 623f18b22..bd2392c67 100644
--- a/source/slang/slang-check-impl.h
+++ b/source/slang/slang-check-impl.h
@@ -23,15 +23,15 @@ namespace Slang
// A flat representation of basic types (scalars, vectors and matrices)
// that can be used as lookup key in caches
- enum class BasicTypeKey : uint8_t
+ enum class BasicTypeKey : uint16_t
{
- Invalid = 0xff, ///< Value that can never be a valid type
+ Invalid = 0xffff, ///< Value that can never be a valid type
};
- SLANG_FORCE_INLINE BasicTypeKey makeBasicTypeKey(BaseType baseType, IntegerLiteralValue dim1 = 1, IntegerLiteralValue dim2 = 1)
+ SLANG_FORCE_INLINE BasicTypeKey makeBasicTypeKey(BaseType baseType, IntegerLiteralValue dim1 = 0, IntegerLiteralValue dim2 = 0)
{
- SLANG_ASSERT(dim1 > 0 && dim2 > 0);
- return BasicTypeKey((uint8_t(baseType) << 4) | ((uint8_t(dim1) - 1) << 2) | (uint8_t(dim2) - 1));
+ SLANG_ASSERT(dim1 >= 0 && dim2 >= 0);
+ return BasicTypeKey((uint8_t(baseType) << 8) | (uint8_t(dim1) << 4) | uint8_t(dim2));
}
inline BasicTypeKey makeBasicTypeKey(Type* typeIn)