yum-slop/modular_slang
write individual HLSL modules/libraries in slang
git clone https://git.yummers.dev/yum-slop/modular_slang
83f9f78
master
modular slang
the idea here is just to make something like slangc.exe, but which treats entrypoints like regular functions.
basics and gotchas
- all functions marked
publicare exported as entrypoints. - we use a custom build of slang which lets entrypoints use regular arguments instead of cbuffers / structs.
- it is intended for use with simple math kernels
- see
example.slangfor an example. you'd#include example.hlslin the rest of some shader and call the public APIs.
- see
usage
- import unitypackage
- right click .slang file, select 'Translate to HLSL'
- it should also auto recompile whenever you tab back into unity
- import the generated .hlsl in your shader
build instructions
git clone https://github.com/yum-food/slangcd slanggit submodule update--init --recursive -j 32# wait, the previous command takes a while mkdir buildcd buildcmake.exe ..cmake.exe --build .-j 32--config Release# the previous command will take a long fucking time cd ../..# if in powershell, do this: powershell.exe ./build.ps1&& ./dist/modular_slang.exe ./demo.slang# if in bash, do this: ./build.sh && ./dist/modular_slang.exe ./demo.slang
1## modular slang 2 3the idea here is just to make something like slangc.exe, but which treats 4entrypoints like regular functions. 5 6basics and gotchas 7 8- all functions marked `public` are exported as entrypoints. 9- we use a custom build of slang which lets entrypoints use regular arguments 10instead of cbuffers / structs. 11 - it is intended for use with simple math kernels 12- see `example.slang` for an example. you'd `#include example.hlsl` in the 13rest of some shader and call the public APIs. 14 15 usage 16 17- import unitypackage 18- right click .slang file, select 'Translate to HLSL' 19- it should also auto recompile whenever you tab back into unity 20- import the generated .hlsl in your shader 21 22build instructions 23 24``` bash 25git clone https://github.com/yum-food/slang 26cd slang 27git submodule update --init --recursive -j 32 28# wait, the previous command takes a while 29mkdir build 30cd build 31cmake.exe .. 32cmake.exe --build . -j 32 --config Release 33# the previous command will take a long fucking time 34cd ../.. 35# if in powershell, do this: 36powershell.exe ./build.ps1 && ./dist/modular_slang.exe ./demo.slang 37# if in bash, do this: 38./build.sh && ./dist/modular_slang.exe ./demo.slang 39``` 40