blob: 5b0279bb5fb3dd8005b05f09c6ca09bb010d849e (
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
29
30
31
32
33
34
35
36
37
38
|
// entry-point-uniform-params.slang
//TEST(compute):COMPARE_COMPUTE: -shaderobj
//TEST(compute):COMPARE_COMPUTE:-cuda -shaderobj
//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj
// Test that a shader can be written that
// only uses entry point `uniform` parameters,
// without any global parameters.
struct Data
{
int a;
int b;
}
int test(int val, int a, int b)
{
return a*(val+1) + b*(val+2);
}
[numthreads(4, 1, 1)]
[shader("compute")]
void computeMain(
//TEST_INPUT:uniform(data=[256 1]):name=d
uniform Data d,
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
uniform RWStructuredBuffer<int> outputBuffer,
uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint tid = dispatchThreadID.x;
int inVal = tid;
int outVal = test(inVal, d.a, d.b);
outputBuffer[tid] = outVal;
}
|