@@ -850,6 +850,125 @@ namespace Slang
850
850
Profile m_profile;
851
851
};
852
852
853
+ class TypeConformance
854
+ : public ComponentType
855
+ , public slang::ITypeConformance
856
+ {
857
+ typedef ComponentType Super;
858
+
859
+ public:
860
+ SLANG_REF_OBJECT_IUNKNOWN_ALL
861
+
862
+ ISlangUnknown* getInterface (const Guid& guid);
863
+
864
+ TypeConformance (
865
+ Linkage* linkage,
866
+ SubtypeWitness* witness,
867
+ Int confomrmanceIdOverride,
868
+ DiagnosticSink* sink);
869
+
870
+ // Forward `IComponentType` methods
871
+
872
+ SLANG_NO_THROW slang::ISession* SLANG_MCALL getSession () SLANG_OVERRIDE
873
+ {
874
+ return Super::getSession ();
875
+ }
876
+
877
+ SLANG_NO_THROW slang::ProgramLayout* SLANG_MCALL
878
+ getLayout (SlangInt targetIndex, slang::IBlob** outDiagnostics) SLANG_OVERRIDE
879
+ {
880
+ return Super::getLayout (targetIndex, outDiagnostics);
881
+ }
882
+
883
+ SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCode (
884
+ SlangInt entryPointIndex,
885
+ SlangInt targetIndex,
886
+ slang::IBlob** outCode,
887
+ slang::IBlob** outDiagnostics) SLANG_OVERRIDE
888
+ {
889
+ return Super::getEntryPointCode (entryPointIndex, targetIndex, outCode, outDiagnostics);
890
+ }
891
+
892
+ SLANG_NO_THROW SlangResult SLANG_MCALL specialize (
893
+ slang::SpecializationArg const * specializationArgs,
894
+ SlangInt specializationArgCount,
895
+ slang::IComponentType** outSpecializedComponentType,
896
+ ISlangBlob** outDiagnostics) SLANG_OVERRIDE
897
+ {
898
+ return Super::specialize (
899
+ specializationArgs,
900
+ specializationArgCount,
901
+ outSpecializedComponentType,
902
+ outDiagnostics);
903
+ }
904
+
905
+ SLANG_NO_THROW SlangResult SLANG_MCALL link (
906
+ slang::IComponentType** outLinkedComponentType,
907
+ ISlangBlob** outDiagnostics) SLANG_OVERRIDE
908
+ {
909
+ return Super::link (outLinkedComponentType, outDiagnostics);
910
+ }
911
+
912
+ SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointHostCallable (
913
+ int entryPointIndex,
914
+ int targetIndex,
915
+ ISlangSharedLibrary** outSharedLibrary,
916
+ slang::IBlob** outDiagnostics) SLANG_OVERRIDE
917
+ {
918
+ return Super::getEntryPointHostCallable (
919
+ entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics);
920
+ }
921
+
922
+ List<Module*> const & getModuleDependencies () SLANG_OVERRIDE;
923
+ List<String> const & getFilePathDependencies () SLANG_OVERRIDE;
924
+
925
+ SLANG_NO_THROW Index SLANG_MCALL getSpecializationParamCount () SLANG_OVERRIDE { return 0 ; }
926
+
927
+ // / Get the existential type parameter at `index`.
928
+ SpecializationParam const & getSpecializationParam (Index /* index*/ ) SLANG_OVERRIDE
929
+ {
930
+ static SpecializationParam emptyParam;
931
+ return emptyParam;
932
+ }
933
+
934
+ Index getRequirementCount () SLANG_OVERRIDE;
935
+ RefPtr<ComponentType> getRequirement (Index index) SLANG_OVERRIDE;
936
+ Index getEntryPointCount () SLANG_OVERRIDE { return 0 ; };
937
+ RefPtr<EntryPoint> getEntryPoint (Index index) SLANG_OVERRIDE
938
+ {
939
+ SLANG_UNUSED (index );
940
+ return nullptr ;
941
+ }
942
+ String getEntryPointMangledName (Index /* index*/ ) SLANG_OVERRIDE { return " " ; }
943
+
944
+ Index getShaderParamCount () SLANG_OVERRIDE { return 0 ; }
945
+ ShaderParamInfo getShaderParam (Index index) SLANG_OVERRIDE
946
+ {
947
+ SLANG_UNUSED (index );
948
+ return ShaderParamInfo ();
949
+ }
950
+
951
+ SubtypeWitness* getSubtypeWitness () { return m_subtypeWitness; }
952
+ IRModule* getIRModule () { return m_irModule.Ptr (); }
953
+ protected:
954
+ void acceptVisitor (ComponentTypeVisitor* visitor, SpecializationInfo* specializationInfo)
955
+ SLANG_OVERRIDE;
956
+
957
+ RefPtr<SpecializationInfo> _validateSpecializationArgsImpl (
958
+ SpecializationArg const * args,
959
+ Index argCount,
960
+ DiagnosticSink* sink) SLANG_OVERRIDE;
961
+ private:
962
+ SubtypeWitness* m_subtypeWitness;
963
+ ModuleDependencyList m_moduleDependency;
964
+ FilePathDependencyList m_pathDependency;
965
+ List<RefPtr<Module>> m_requirements;
966
+ HashSet<Module*> m_requirementSet;
967
+ RefPtr<IRModule> m_irModule;
968
+ Int m_conformanceIdOverride;
969
+ void addDepedencyFromWitness (SubtypeWitness* witness);
970
+ };
971
+
853
972
enum class PassThroughMode : SlangPassThroughIntegral
854
973
{
855
974
None = SLANG_PASS_THROUGH_NONE, // /< don't pass through: use Slang compiler
@@ -1319,6 +1438,12 @@ namespace Slang
1319
1438
slang::TypeReflection* type,
1320
1439
slang::TypeReflection* interfaceType,
1321
1440
uint32_t * outId) override ;
1441
+ SLANG_NO_THROW SlangResult SLANG_MCALL createTypeConformanceComponentType (
1442
+ slang::TypeReflection* type,
1443
+ slang::TypeReflection* interfaceType,
1444
+ slang::ITypeConformance** outConformance,
1445
+ SlangInt conformanceIdOverride,
1446
+ ISlangBlob** outDiagnostics) override ;
1322
1447
SLANG_NO_THROW SlangResult SLANG_MCALL createCompileRequest (
1323
1448
SlangCompileRequest** outCompileRequest) override ;
1324
1449
@@ -1756,6 +1881,7 @@ namespace Slang
1756
1881
virtual void visitModule (Module* module, Module::ModuleSpecializationInfo* specializationInfo) = 0;
1757
1882
virtual void visitComposite (CompositeComponentType* composite, CompositeComponentType::CompositeSpecializationInfo* specializationInfo) = 0;
1758
1883
virtual void visitSpecialized (SpecializedComponentType* specialized) = 0;
1884
+ virtual void visitTypeConformance (TypeConformance* conformance) = 0;
1759
1885
1760
1886
protected:
1761
1887
// These helpers can be used to recurse into the logical children of a
0 commit comments