-
Notifications
You must be signed in to change notification settings - Fork 852
Expand file tree
/
Copy pathtemplate_uninitialized_values.hlsl
More file actions
63 lines (57 loc) · 1.29 KB
/
template_uninitialized_values.hlsl
File metadata and controls
63 lines (57 loc) · 1.29 KB
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
54
55
56
57
58
59
60
61
62
63
// RUN: dxc -E main -T cs_6_6 -HV 2021 -Wno-unused-value %s | FileCheck %s
// Asserts in UnitializedValues.cpp were triggered by the following code
// examples. The cause was that HLSL out parameters or local variables from
// template instantiations may not be present in the declToIndex map when the
// variable's DeclContext differs from the analysis context (common in
// template instantiations).
// The fix was to add defensive checks so that if the variable isn't tracked
// it is silently ignored.
// CHECK: define void @main()
template <typename R>
void test(R x, out uint result) {
uint repro = 0;
result = 10;
}
[numthreads(32, 32, 1)] void main(uint2 threadId: SV_DispatchThreadID) {
uint x;
test(10, x);
}
template <typename NameType>
void func2(out uint var1)
{
uint var3;
uint var4;
uint var5;
uint var6;
uint var7;
uint var8;
uint var9;
uint var10;
uint var11;
uint var12;
uint var13;
uint var14;
uint var15;
uint var16;
uint var17;
uint var18;
uint var19;
uint var20;
uint var21;
uint var22;
uint var23;
uint var24;
uint var25;
uint var26;
uint var27;
uint var28;
uint var29;
uint var30;
uint var31;
var1;
}
void func1()
{
uint var33;
func2<uint>(var33);
}