blob: 583221ee398832cf809b9b461cc30b75d19fbcaa (
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
|
// ssa-loop.slang
// Bug related to SSA form for loops
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
int test(int val)
{
int N = val;
int x = 0;
int y = 1;
for(int i = 0; i < N; ++i)
{
int t = x;
x = y;
y = t;
}
return x*16 + y;
}
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=gOutputBuffer
RWStructuredBuffer<int> gOutputBuffer;
[numthreads(4, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
int tid = dispatchThreadID.x;
int inputVal = tid;
int outputVal = test(inputVal);
gOutputBuffer[tid] = outputVal;
}
|