yum-mirror/slang

Making it easier to work with shaders

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

Tim FoleyConvert more tests to use shader objects (#1659)2a5d5b323

master
810 B44 linesraw
1//TEST(compute):COMPARE_COMPUTE: -shaderobj
2//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj
3
4// test specialization of nested generic functions
5
6//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
7RWStructuredBuffer<int> outputBuffer;
8
9interface IBRDF
10{
11    float getF();
12}
13
14interface ILight
15{
16    float illum<B:IBRDF>(B b);
17};
18
19struct B0 : IBRDF
20{
21    float getF() { return 1.0; }
22};
23
24struct L0 : ILight
25{
26    float illum<B:IBRDF>(B b) { return b.getF(); }
27};
28
29struct L1<L:ILight> : ILight
30{
31    L l;
32    float illum<BXX:IBRDF>(BXX bxx) { return l.illum<BXX>(bxx); }
33};
34
35
36[numthreads(4, 1, 1)]
37void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
38{
39	uint tid = dispatchThreadID.x;
40    L1<L0> light;
41    B0 b0;
42	float outVal = light.illum<B0>(b0);
43	outputBuffer[tid] = int(outVal);
44}