blob: 4d5b8f5b3b3bc6bb0fc45543fceb452af8da7b25 (
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
|
//DIAGNOSTIC_TEST:SIMPLE: -target hlsl -DTEST_1
//DIAGNOSTIC_TEST:SIMPLE: -target hlsl -DTEST_2
SamplerState sampler;
struct Foo
{
bool sample_bar = false;
#ifdef TEST_1
Texture2D<float4> bar = {};
#elif defined(TEST_2)
Texture2D<float4> bar[2];
#endif
};
struct Result
{
float4 color = float4(0.0);
};
Result process(in Foo foo)
{
Result result = {};
if (foo.sample_bar) {
#ifdef TEST_1
result.color = foo.bar.Sample(sampler, float2(0.0, 0.0));
#elif defined(TEST_2)
result.color = foo.bar[0].Sample(sampler, float2(0.0, 0.0));
#endif
}
return result;
}
[shader("compute")]
[numthreads(8, 8, 1)]
float4 cs_main(uint3 thread_id : SV_DispatchThreadID) {
Foo foo;
const let result = process(foo);
return result.color;
}
|