yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1#ifndef SLANG_FILE_SYSTEM_H 2#define SLANG_FILE_SYSTEM_H 3 4#include "../../core/slang-com-object.h" 5#include "record-manager.h" 6#include "slang-com-helper.h" 7#include "slang-com-ptr.h" 8 9namespace SlangRecord 10{ 11 12using namespace Slang ; 13 14// slang always requires ISlangFileSystemExt interface, even if user only provides ISlangFileSystem, 15// slang will still wrap it with ISlangFileSystemExt. So we have to record ISlangFileSystemExt, even 16// though we only need to record loadFile() function. 17class FileSystemRecorder :public RefObject ,public ISlangFileSystemExt 18{ 19public : 20explicit FileSystemRecorder (ISlangFileSystemExt * fileSystem ,RecordManager * recordManager ); 21 22// ISlangUnknown 23SLANG_REF_OBJECT_IUNKNOWN_ALL 24 25ISlangUnknown * getInterface (const Slang ::Guid & guid ); 26 27// ISlangCastable 28virtual SLANG_NO_THROW void * SLANG_MCALL castAs (const Slang ::Guid & guid )override ; 29 30// ISlangFileSystem 31virtual SLANG_NO_THROW SlangResult SLANG_MCALL 32loadFile (char const * path ,ISlangBlob ** outBlob )override ; 33 34// ISlangFileSystemExt 35virtual SLANG_NO_THROW SlangResult SLANG_MCALL 36getFileUniqueIdentity (const char * path ,ISlangBlob ** outUniqueIdentity )override ; 37 38virtual SLANG_NO_THROW SlangResult SLANG_MCALL calcCombinedPath ( 39SlangPathType fromPathType , 40const char * fromPath , 41const char * path , 42ISlangBlob ** pathOut )override ; 43 44virtual SLANG_NO_THROW SlangResult SLANG_MCALL 45getPathType (const char * path ,SlangPathType * pathTypeOut )override ; 46 47virtual SLANG_NO_THROW SlangResult SLANG_MCALL 48getPath (PathKind kind ,const char * path ,ISlangBlob ** outPath )override ; 49 50virtual SLANG_NO_THROW void SLANG_MCALL clearCache ()override ; 51 52virtual SLANG_NO_THROW SlangResult SLANG_MCALL enumeratePathContents ( 53const char * path, 54FileSystemContentsCallBack callback, 55void * userData) override; 56 57virtual SLANG_NO_THROW OSPathKind SLANG_MCALL getOSPathKind () override; 58 59private: 60Slang::ComPtr < ISlangFileSystemExt > m_actualFileSystem; 61RecordManager * m_recordManager = nullptr ; 62}; 63 64} // namespace SlangRecord 65#endif