blob: 4acc3a37c161ab431344506aee8730161d54cd1e (
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
|
//TEST:CPP_COMPILER_COMPILE: -profile cs_5_0 -entry computeMain -target callable
struct Thing
{
int a;
float b;
};
static int value;
// Don't use parameter block for now
//ParameterBlock<AnotherThing> s_paramBlock;
ConstantBuffer<Thing> thing3;
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out
RWStructuredBuffer<int> outputBuffer;
Texture2D<float> tex;
SamplerState sampler;
void doSomething(int a, inout float3 v[2])
{
v[0] = float3(float(a));
v[1] = float3(float(a + 1));
}
[numthreads(4, 1, 1)]
void computeMain(
uint3 dispatchThreadID : SV_DispatchThreadID,
uniform Thing thing,
uniform Thing thing2)
{
uint tid = dispatchThreadID.x;
int2 fromScalar = tid.x;
uint2 another = {};
float2 loc = dispatchThreadID.xy * 0.5f;
float v = tex.Load(int3(tid, tid, 0));
float s = tex.Sample(sampler, loc);
// This should promote the 0.0 into a float2,
float l = tex.Sample(sampler, 0.0);
float3 m = float(3).xxx;
float3 arr[2] = { float3(3), float3(4) };
doSomething(int(tid), arr);
outputBuffer[tid] = int(tid * tid) + thing.a + thing3.a + int(v + s) + value + fromScalar.y + int(another.y) + int(m.x) + int(l) + int(arr[0].y); // + thing.a;
}
|