yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1// library-test.slang 2 3// A test to try out the basics of using libraries that can be linked (by downstream tools). 4// (This is in contrast to Slang modules and Slangs own linkage mechanisms) 5 6// This didn't work for lib_6_2 when compiling via DXC (!). Even though it's stated elsewhere the feature is available from 6.1 7 8//TEST:COMPILE: tests/library/library.slang -incomplete-library -profile lib_6_3 -target dxil -o tests/library/library.dxil 9//TEST:COMPILE: tests/library/library-test.slang -incomplete-library -entry computeMain -profile cs_6_3 -target dxil -r tests/library/library.dxil -o tests/library/library-test.dxil 10 11// Test the produced kernel. 12 13//TEST:COMPARE_COMPUTE_EX:-slang -compute -profile cs_6_3 -dx12 -shaderobj -Xslang... -r tests/library/library.dxil -incomplete-library -X. 14 15extern int foo(int a); 16 17//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=4):out,name outputBuffer 18RWStructuredBuffer<int> outputBuffer; 19 20[shader("compute")] 21[numthreads(4, 1, 1)] 22void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 23{ 24 int index = (int)dispatchThreadID.x; 25 26 outputBuffer[index] = foo(index); 27}