yum-mirror/slang

Making it easier to work with shaders

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

Tim FoleyRemove old code paths from render-test (#1760)6e5d85efb

master
641 B28 linesraw
1// global-uniform-params.slang
2
3//DISABLED_TEST(compute):COMPARE_COMPUTE:
4
5// Test that code can use uniform parameters
6// of "ordinary" type declared at the global scope
7
8//TEST_INPUT:cbuffer(data=[256 1]):name=$Globals
9uniform int a;
10uniform int b;
11
12int test(int val)
13{
14	return a*(val+1) + b*(val+2);
15}
16
17//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
18RWStructuredBuffer<int> outputBuffer;
19
20[numthreads(4, 1, 1)]
21[shader("compute")]
22void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
23{
24    uint tid = dispatchThreadID.x;
25    int inVal = tid;
26    int outVal = test(inVal);
27    outputBuffer[tid] = outVal;
28}