yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeVarious fixes to GFX, nested parameter block test for d3d12. (#2081)b2f4cb118

master
715 B37 linesraw
1// parameter-block.slang
2
3struct CB
4{
5    uint4 value;
6}
7
8struct MaterialSystem
9{
10    CB cb;
11    StructuredBuffer<uint4> data;
12}
13
14struct Scene
15{
16    CB sceneCb;
17    StructuredBuffer<uint4> data;
18    ParameterBlock<MaterialSystem> material;
19}
20
21cbuffer PerView
22{
23    uint4 value;
24}
25
26ParameterBlock<Scene> scene;
27
28RWStructuredBuffer<uint4> resultBuffer;
29
30// Main entry-point. Applies the transformation encoded by `transformer`
31// to all elements in `buffer`.
32[shader("compute")]
33[numthreads(4,1,1)]
34void computeMain(uint3 sv_dispatchThreadID : SV_DispatchThreadID)
35{
36    resultBuffer[sv_dispatchThreadID.x] = value.x + scene.sceneCb.value.x + scene.data[0].x + scene.material.cb.value.x + scene.material.data[0].x;
37}