summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/shader-params/global-uniform-params.slang
blob: fff82136afe1f33e639b89a3f9ab27bec9af7e52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// global-uniform-params.slang

//DISABLED_TEST(compute):COMPARE_COMPUTE:

// Test that code can use uniform parameters
// of "ordinary" type declared at the global scope

//TEST_INPUT:cbuffer(data=[256 1]):name=$Globals
uniform int a;
uniform int b;

int test(int val)
{
	return a*(val+1) + b*(val+2);
}

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;

[numthreads(4, 1, 1)]
[shader("compute")]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    uint tid = dispatchThreadID.x;
    int inVal = tid;
    int outVal = test(inVal);
    outputBuffer[tid] = outVal;
}