yum-slop/modular_slang
write individual HLSL modules/libraries in slang
git clone https://git.yummers.dev/yum-slop/modular_slang
83f9f78
master
languages
- C++ 47.7%
- C# 22.0%
- Diff 21.2%
- CMake 5.3%
- Markdown 2.7%
- PowerShell 1.2%
files
| Scripts/Editor/ | |
| .gitignore | 16 B |
| CMakeLists.txt | 2.3 KiB |
| LICENSE | 1.0 KiB |
| README.md | 1.2 KiB |
| build.ps1 | 531 B |
| example.slang | 2.2 KiB |
| main.cc | 20.7 KiB |
| slang.patch | 9.2 KiB |
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