yum-mirror/slang

Making it easier to work with shaders

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

jsmall-nvidiaLanguage experiments (#2068)447b7e0e2

master
983 B35 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2
3/* Test to control altering of an algorithm via generic compile time values.
4
5slang(28): note 99999: an internal error threw an exception while working on code near this location
6(0): error 99999: Slang compilation aborted due to an exception of class Slang::InternalError: unexpected: could not resolve target declaration for call
7
8Seems like it's the default value (=1) that leads to this crash. If we explicitly specify it's ok.
9 */
10
11//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
12RWStructuredBuffer<float> outputBuffer;
13
14int reduce<let Clustering : int, let DupTest : int = 1>( int a)
15{
16    if (Clustering)
17    {
18        a = a + a;
19    }
20    if (DupTest)
21    {
22        a *= a;
23    }
24    return a;
25}
26
27[numthreads(4, 1, 1)]
28void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
29{
30    int index = dispatchThreadID.x;
31
32    int r = reduce<1>(index);
33    
34	outputBuffer[index] = r;
35}