blob: 0a4744b7138028dc51c5094e8d9de1d492559167 (
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
|
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
// Failure to pass compile-time-constant data
// where it is expected.
//
// In this case, the place where compile-time-constant
// data is expected is the texel offset parameter to
// the `Texture2D.Sample` operation.
Texture2D t;
SamplerState s;
cbuffer U
{
float2 uv;
uint2 offset;
};
float4 main() : SV_Target
{
float4 result = 0.0f;
// Okay, immediate constant
result += t.Sample(s, uv, int2(0,0));
// Error: data passed through cbuffer isn't compile-time constant
// CHECK: ([[# @LINE+1]]): error 40006:
result += t.Sample(s, uv, offset);
// Error: data computed via conditional isn't compile-time cosntant
uint ii = 0;
if(uv.x > 0.0f)
{
ii = 1;
}
// CHECK: ([[# @LINE+1]]): error 40006:
result += t.Sample(s, uv, int2(ii));
// Error: data computed in loop isn't compile-time constant
// (and loop isn't unroll-able)
// CHECK: ([[# @LINE+1]]): error 40006:
for(uint jj = 0; jj < uv.y; jj++)
{
result += t.Sample(s, uv, int2(jj));
}
return result;
}
|