blob: 5bebd69ac257c6daace0b302a4d13fbdf92f05f9 (
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
|
// func-resource-result-simple.slang
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute
//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute
// Test that a function that returns a resource type can be
// compiled for targets that don't natively support resource
// return values.
//TEST_INPUT:ubuffer(data=[0x11 0x22 0x33 0x44], stride=4):name=inputBuffer
RWStructuredBuffer<int> inputBuffer;
RWStructuredBuffer<int> getInputBuffer() { return inputBuffer; }
int test(int val)
{
return getInputBuffer()[val];
}
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint tid = dispatchThreadID.x;
int inVal = tid;
int outVal = test(inVal);
outputBuffer[tid] = outVal;
}
|