blob: 8d475254f52dddc433842dbec0ff176e7159cf6e (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// interface-shader-param-ordinary.slang
// This test is for interface-type shader parameters that
// get specialized to types that include "ordinary" data
// but also don't fit into the allocation provided for
// them in the existential-type field itself.
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile sm_6_0 -use-dxil
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute
interface IModifier
{
int modify(int value);
}
//TEST_INPUT:set gOutputBuffer = out ubuffer(data=[0 0 0 0], stride=4)
RWStructuredBuffer<int> gOutputBuffer;
//TEST_INPUT:set delta = 65536
uniform int delta;
//TEST_INPUT:set gModifier = new MyModifier{ ubuffer(data=[4 3 2 1], stride=4), 3 } }
uniform IModifier gModifier;
int test(int val)
{
return gModifier.modify(val) + delta;
}
[numthreads(4, 1, 1)]
void computeMain(
uint3 dispatchThreadID : SV_DispatchThreadID)
{
let tid = dispatchThreadID.x;
let inputVal : int = tid;
let outputVal = test(inputVal);
gOutputBuffer[tid] = outputVal;
}
struct MyModifier : IModifier
{
RWStructuredBuffer<int> data;
int extra;
int modify(int val)
{
return val*65536 + data[val]*256 + val*extra;
}
}
|