summaryrefslogtreecommitdiff
path: root/source/slang/slang-reflection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-reflection.cpp')
-rw-r--r--source/slang/slang-reflection.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/slang/slang-reflection.cpp b/source/slang/slang-reflection.cpp
index 59130b0fc..306c45c14 100644
--- a/source/slang/slang-reflection.cpp
+++ b/source/slang/slang-reflection.cpp
@@ -1499,3 +1499,27 @@ SLANG_API SlangReflectionType* spReflection_specializeType(
return convert(specializedType);
}
+
+SLANG_API SlangUInt spReflection_getHashedStringCount(
+ SlangReflection* reflection)
+{
+ auto programLayout = convert(reflection);
+ return programLayout->hashedStringLiteralPool.getNumSlices() - StringSlicePool::kNumDefaultHandles;
+}
+
+SLANG_API const char* spReflection_getHashedString(
+ SlangReflection* reflection,
+ SlangUInt index,
+ size_t* outCount)
+{
+ auto programLayout = convert(reflection);
+ UnownedStringSlice slice = programLayout->hashedStringLiteralPool.getSlice(StringSlicePool::Handle(index + StringSlicePool::kNumDefaultHandles));
+ *outCount = slice.size();
+ return slice.begin();
+}
+
+SLANG_API int spCalcStringHash(const char* chars, size_t count)
+{
+ UnownedStringSlice slice(chars, count);
+ return GetHashCode(slice);
+}