summaryrefslogtreecommitdiff
path: root/source/slang/slang-compiler.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-05-21 16:38:33 -0700
committerGitHub <noreply@github.com>2021-05-21 16:38:33 -0700
commit7f8a9994d0bd99a171a1daa0bce46d92c02ccffd (patch)
tree0b187e63ab5b9ce6f5ab41266fedaec44091a217 /source/slang/slang-compiler.h
parent172538fdb418f7a2faab1f5a410f3b2cb8e18ba5 (diff)
[gfx] Support StructuredBuffer<IInterface>. (#1851)
Co-authored-by: T. Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-compiler.h')
-rwxr-xr-xsource/slang/slang-compiler.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index 54c61bd75..603ee0bb5 100755
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -1199,14 +1199,10 @@ namespace Slang
// TypeLayouts created on the fly by reflection API
Dictionary<Type*, RefPtr<TypeLayout>> typeLayouts;
- Dictionary<Type*, ParameterBlockType*> parameterBlockTypes;
-
Dictionary<Type*, RefPtr<TypeLayout>>& getTypeLayouts() { return typeLayouts; }
TypeLayout* getTypeLayout(Type* type);
- TypeLayout* getParameterBlockLayout(Type* type);
-
private:
Linkage* linkage = nullptr;
CodeGenTarget format = CodeGenTarget::Unknown;
@@ -1251,6 +1247,21 @@ namespace Slang
const char* getBuildTagString();
struct TypeCheckingCache;
+
+ struct ContainerTypeKey
+ {
+ slang::TypeReflection* elementType;
+ slang::ContainerType containerType;
+ bool operator==(ContainerTypeKey other)
+ {
+ return elementType == other.elementType && containerType == other.containerType;
+ }
+ Slang::HashCode getHashCode()
+ {
+ return Slang::combineHash(
+ Slang::getHashCode(elementType), Slang::getHashCode(containerType));
+ }
+ };
/// A context for loading and re-using code modules.
class Linkage : public RefObject, public slang::ISession
@@ -1279,11 +1290,11 @@ namespace Slang
SlangInt targetIndex = 0,
slang::LayoutRules rules = slang::LayoutRules::Default,
ISlangBlob** outDiagnostics = nullptr) override;
- SLANG_NO_THROW slang::TypeLayoutReflection* SLANG_MCALL getParameterBlockLayout(
+ SLANG_NO_THROW slang::TypeReflection* SLANG_MCALL getContainerType(
slang::TypeReflection* elementType,
- SlangInt targetIndex = 0,
- slang::LayoutRules rules = slang::LayoutRules::Default,
+ slang::ContainerType containerType,
ISlangBlob** outDiagnostics = nullptr) override;
+ SLANG_NO_THROW slang::TypeReflection* SLANG_MCALL getDynamicType() override;
SLANG_NO_THROW SlangResult SLANG_MCALL getTypeRTTIMangledName(
slang::TypeReflection* type,
ISlangBlob** outNameBlob) override;
@@ -1348,6 +1359,9 @@ namespace Slang
RefPtr<ASTBuilder> m_astBuilder;
+ // Cache for container types.
+ Dictionary<ContainerTypeKey, Type*> m_containerTypes;
+
// cache used by type checking, implemented in check.cpp
TypeCheckingCache* getTypeCheckingCache();
void destroyTypeCheckingCache();