yum-mirror/slang

Making it easier to work with shaders

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

Yong HeRefactor `gfx` to surface `CommandBuffer` interface. (#1735)a5ac4999b

master
873 B34 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE:-dx11 -shaderobj
2// TODO: disable this test to get new gfx checked in, need to re-enable
3// after shader-object binding model is fixed.
4
5[anyValueSize(8)]
6interface IMaterial
7{
8    float eval();
9}
10
11struct MaterialImpl : IMaterial
12{
13    float eval() { return 0.0f; }
14};
15
16struct Parameters
17{
18    uint ordinary;
19
20//TEST_INPUT: entryPointExistentialType MaterialImpl
21//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0], stride=4):name=params.materials
22    RWStructuredBuffer<IMaterial> materials;
23
24//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=params.result
25    RWStructuredBuffer<float> result;
26};
27
28[numthreads(4, 1, 1)]
29void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID, uniform Parameters params, uniform int id)
30{
31    uint tid = dispatchThreadID.x;
32    float rs = params.materials[0].eval();
33    params.result[tid] = rs;
34}