yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1#ifndef SLANG_SOURCE_EMBED_UTIL_H 2#define SLANG_SOURCE_EMBED_UTIL_H 3 4#include "../core/slang-basic.h" 5#include "../core/slang-name-value.h" 6#include "slang-artifact.h" 7#include "slang-com-ptr.h" 8#include "slang-diagnostic-sink.h" 9 10namespace Slang 11{ 12 13 14struct SourceEmbedUtil 15{ 16enum class Style :uint32_t 17 { 18None ,///< No embedding 19Default ,///< Default embedding for the type 20Text ,///< Embed as text. May change line endings. If output isn't text will use 'default'. 21///< Size will *not* contain terminating 0 22BinaryText ,///< Embed as text assuming contents is binary. 23U8 ,///< Embed as unsigned bytes 24U16 ,///< Embed as uint16_t 25U32 ,///< Embed as uint32_t 26U64 ,///< Embed as uint64_t 27CountOf , 28 }; 29 30struct Options 31 { 32Style style = Style ::Default ;///< Style of embedding 33Count lineLength = 120 ;///< The line length, lines can be larger for some styles, but will 34///< aim to keep within range 35SlangSourceLanguage language = SLANG_SOURCE_LANGUAGE_C ;///< The language to output for 36String variableName ;///< The name to give the variable 37String indent = " ";///< Indenting 38 }; 39 40/// Get the style infos 41static ConstArrayView < NamesDescriptionValue > getStyleInfos (); 42 43/// Given an artifact and 44static SlangResult createEmbedded ( 45IArtifact * artifact , 46const Options & options , 47ComPtr < IArtifact >& outArtifact ); 48 49/// Returns the default style for the desc 50static Style getDefaultStyle (const ArtifactDesc & desc ); 51 52/// Returns true if supports the specified language for embedding 53static bool isSupported (SlangSourceLanguage lang ); 54 55/// Given the path return the output path. If no path is available return the empty string 56static String getPath (const String & path ,const Options & options ); 57}; 58 59}// namespace Slang 60 61#endif