yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
9c8fab83a
master
1#ifndef SLANG_ENTRY_POINT_H 2#define SLANG_ENTRY_POINT_H 3 4#include "../../core/slang-dictionary.h" 5#include "../../core/slang-smart-pointer.h" 6#include "../../slang/slang-compiler.h" 7#include "record-manager.h" 8#include "slang-com-helper.h" 9#include "slang-com-ptr.h" 10#include "slang-component-type.h" 11#include "slang.h" 12 13namespace SlangRecord 14{ 15using namespace Slang ; 16class SessionRecorder ; 17 18class IEntryPointRecorder :public slang ::IEntryPoint ,public RefObject 19{ 20public : 21// SLANG_COM_INTERFACE(0xf4c1e23d, 0xb321, 0x4931, { 0x8f, 0x37, 0xf1, 0x22, 0x6a, 0xf9, 0x20, 22// 0x85 }) SLANG_REF_OBJECT_IUNKNOWN_ALL ISlangUnknown* getInterface(const Guid& guid) { 23// (void)guid; return nullptr;} 24SLANG_COM_INTERFACE ( 250xf4c1e23d , 260xb321 , 270x4931 , 28 {0x8f ,0x37 ,0xf1 ,0x22 ,0x6a ,0xf9 ,0x20 ,0x85 }) 29}; 30 31class EntryPointRecorder :public IEntryPointRecorder ,public IComponentTypeRecorder 32{ 33typedef IComponentTypeRecorder Super ; 34 35public : 36SLANG_REF_OBJECT_IUNKNOWN_ALL 37ISlangUnknown * getInterface (const Guid & guid ); 38 39explicit EntryPointRecorder ( 40SessionRecorder * sessionRecorder , 41slang ::IEntryPoint * entryPoint , 42RecordManager * recordManager ); 43 44// Interfaces for `IComponentType` 45virtual SLANG_NO_THROW slang ::ISession * SLANG_MCALL getSession ()override 46 { 47return Super ::getSession (); 48 } 49 50virtual SLANG_NO_THROW slang ::ProgramLayout * SLANG_MCALL 51getLayout (SlangInt targetIndex = 0 ,slang ::IBlob ** outDiagnostics = nullptr )override 52 { 53return Super ::getLayout (targetIndex ,outDiagnostics ); 54 } 55 56virtual SLANG_NO_THROW SlangInt SLANG_MCALL getSpecializationParamCount ()override 57 { 58return Super ::getSpecializationParamCount (); 59 } 60 61virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCode ( 62SlangInt entryPointIndex , 63SlangInt targetIndex , 64slang ::IBlob ** outCode , 65slang ::IBlob ** outDiagnostics = nullptr)override 66 { 67return Super ::getEntryPointCode (entryPointIndex ,targetIndex ,outCode ,outDiagnostics ); 68 } 69 70virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCode ( 71SlangInt targetIndex , 72slang ::IBlob ** outCode , 73slang ::IBlob ** outDiagnostics = nullptr)override 74 { 75return Super ::getTargetCode (targetIndex ,outCode ,outDiagnostics ); 76 } 77 78SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointMetadata ( 79SlangInt entryPointIndex , 80SlangInt targetIndex , 81slang ::IMetadata ** outMetadata , 82slang ::IBlob ** outDiagnostics )SLANG_OVERRIDE 83 { 84return Super ::getEntryPointMetadata ( 85entryPointIndex , 86targetIndex , 87outMetadata , 88outDiagnostics ); 89 } 90 91SLANG_NO_THROW SlangResult SLANG_MCALL getTargetMetadata ( 92SlangInt targetIndex , 93slang ::IMetadata ** outMetadata , 94slang ::IBlob ** outDiagnostics )SLANG_OVERRIDE 95 { 96return Super ::getTargetMetadata (targetIndex ,outMetadata ,outDiagnostics ); 97 } 98 99virtual SLANG_NO_THROW SlangResult SLANG_MCALL getResultAsFileSystem ( 100SlangInt entryPointIndex , 101SlangInt targetIndex , 102ISlangMutableFileSystem ** outFileSystem )override 103 { 104return Super ::getResultAsFileSystem (entryPointIndex ,targetIndex ,outFileSystem ); 105 } 106 107virtual SLANG_NO_THROW void SLANG_MCALL getEntryPointHash ( 108SlangInt entryPointIndex , 109SlangInt targetIndex , 110slang ::IBlob ** outHash )override 111 { 112return Super ::getEntryPointHash (entryPointIndex ,targetIndex ,outHash ); 113 } 114 115virtual SLANG_NO_THROW SlangResult SLANG_MCALL specialize ( 116slang ::SpecializationArg const * specializationArgs , 117SlangInt specializationArgCount , 118slang ::IComponentType ** outSpecializedComponentType , 119ISlangBlob ** outDiagnostics = nullptr )override 120 { 121return Super ::specialize ( 122specializationArgs , 123specializationArgCount , 124outSpecializedComponentType , 125outDiagnostics ); 126 } 127 128virtual SLANG_NO_THROW SlangResult SLANG_MCALL link ( 129slang ::IComponentType ** outLinkedComponentType , 130ISlangBlob ** outDiagnostics = nullptr )override 131 { 132return Super ::link (outLinkedComponentType ,outDiagnostics ); 133 } 134 135virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointHostCallable ( 136int entryPointIndex , 137int targetIndex , 138ISlangSharedLibrary ** outSharedLibrary , 139slang ::IBlob ** outDiagnostics = 0 )override 140 { 141return Super ::getEntryPointHostCallable ( 142entryPointIndex , 143targetIndex , 144outSharedLibrary , 145outDiagnostics ); 146 } 147 148virtual SLANG_NO_THROW SlangResult SLANG_MCALL 149renameEntryPoint (const char * newName ,IComponentType ** outEntryPoint )override 150 { 151return Super ::renameEntryPoint (newName ,outEntryPoint ); 152 } 153 154virtual SLANG_NO_THROW SlangResult SLANG_MCALL linkWithOptions ( 155IComponentType ** outLinkedComponentType , 156uint32_t compilerOptionEntryCount , 157slang ::CompilerOptionEntry * compilerOptionEntries , 158ISlangBlob ** outDiagnostics = nullptr)override 159 { 160return Super ::linkWithOptions ( 161outLinkedComponentType , 162compilerOptionEntryCount , 163compilerOptionEntries , 164outDiagnostics ); 165 } 166 167// Interfaces for `IEntryPoint` 168virtual SLANG_NO_THROW slang ::FunctionReflection * SLANG_MCALL getFunctionReflection ()override ; 169 170slang ::IEntryPoint * getActualEntryPoint ()const {return m_actualEntryPoint ; } 171 172protected : 173virtual ApiClassId getClassId ()override {return ApiClassId ::Class_IEntryPoint ; } 174 175virtual SessionRecorder * getSessionRecorder ()override {return m_sessionRecorder ; } 176 177private : 178SessionRecorder * m_sessionRecorder ; 179Slang ::ComPtr < slang ::IEntryPoint > m_actualEntryPoint ; 180}; 181}// namespace SlangRecord 182#endif // SLANG_ENTRY_POINT_H