yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1// slang-artifact-container-util.h 2#ifndef SLANG_ARTIFACT_CONTAINER_UTIL_H 3#define SLANG_ARTIFACT_CONTAINER_UTIL_H 4 5#include "slang-artifact-representation.h" 6#include "slang-com-helper.h" 7#include "slang-com-ptr.h" 8 9namespace Slang 10{ 11 12/* Functionality to save of and read artifact hierarchies via the slang 13artifact container style. This style treats storage as a file system. 14 15Since this represention, is not directly a file system representation 16some conventions are used to associate data, via names etc. 17 18The use of ISlangMutableFileSystem, allows writing this structure, to memory, zip, riff, directory 19or other file like representations 20*/ 21struct ArtifactContainerUtil 22{ 23/// Write the container using the specified path. 24/// Uses the extension of the path to determine how to write 25static SlangResult writeContainer (IArtifact * artifact ,const String & path ); 26 27/// If there isn't a suitable name on artifact, the filename is used to generate a name. If it's 28/// not set a name may be generated. 29static SlangResult writeContainer ( 30IArtifact * artifact , 31const String & defaultFileName , 32ISlangMutableFileSystem * fileSystem ); 33 34static SlangResult readContainer ( 35ISlangFileSystemExt * fileSystem , 36ComPtr < IArtifact >& outArtifact ); 37 38/// Read an artifact that represents a container as an artifact hierarchy 39static SlangResult readContainer (IArtifact * artifact ,ComPtr < IArtifact >& outArtifact ); 40 41/// Creates a copy of artifact where 42/// * All artifacts are blobs 43/// * Any generic containers that are empty are dropped 44/// * Any sub artifact that can't be blobed and isn't significant is ignored 45/// 46/// A future improvement would be to take a function to also control what makes it to the output 47static SlangResult filter (IArtifact * artifact ,ComPtr < IArtifact >& outArtifact ); 48}; 49 50}// namespace Slang 51 52#endif