yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1// slang-llvm-compiler.cpp 2#include "slang-llvm-compiler.h" 3 4#include "../core/slang-common.h" 5 6namespace Slang 7{ 8 9/* static */ SlangResult LLVMDownstreamCompilerUtil ::locateCompilers ( 10const String & path , 11ISlangSharedLibraryLoader * loader , 12DownstreamCompilerSet * set ) 13{ 14ComPtr < ISlangSharedLibrary > library ; 15 16SLANG_RETURN_ON_FAIL ( 17DownstreamCompilerUtil ::loadSharedLibrary (path ,loader ,nullptr ,"slang-llvm" ,library )); 18 19SLANG_ASSERT (library ); 20if (!library ) 21 { 22return SLANG_FAIL ; 23 } 24 25typedef SlangResult ( 26* CreateDownstreamCompilerFunc )(const Guid & intf ,IDownstreamCompiler ** outCompiler ); 27 28ComPtr < IDownstreamCompiler > downstreamCompiler ; 29 30// Only accept V4, so we can update IArtifact without breaking anything 31if (auto fnV4 = (CreateDownstreamCompilerFunc )library -> findFuncByName ( 32"createLLVMDownstreamCompiler_V4" )) 33 { 34SLANG_RETURN_ON_FAIL ( 35fnV4 (IDownstreamCompiler ::getTypeGuid (),downstreamCompiler .writeRef ())); 36 } 37else 38 { 39return SLANG_FAIL ; 40 } 41 42set -> addSharedLibrary (library ); 43set -> addCompiler (downstreamCompiler ); 44return SLANG_OK ; 45} 46 47}// namespace Slang