blob: 4519c4b38f56aa8ba8db3b914d6fc278f1dfe132 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
## 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 `public` are 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.slang` for an example. you'd `#include example.hlsl` in the
rest of some shader and call the public APIs.
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
```bash
git clone https://github.com/yum-food/slang
cd slang
git submodule update --init --recursive -j 32
# wait, the previous command takes a while
mkdir build
cd build
cmake.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
```
|