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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
//TEST:SIMPLE(filecheck=CHECK): -allow-glsl -target spirv -emit-spirv-directly -stage raygeneration -entry main -enable-experimental-passes
// Check to ensure we make global ray-tracing objects. Ensure we store into these variables directly and not through a context-pointer.
// CHECK-DAG: %[[RAYTRACING_AS_TYPE:[A-Za-z0-9_]+]] = OpTypeAccelerationStructureKHR
// CHECK-DAG: %[[RAYTRACING_AS_PTR_TYPE:[A-Za-z0-9_]+]] = OpTypePointer UniformConstant %[[RAYTRACING_AS_TYPE]]
// CHECK-DAG: %[[RAYTRACING_AS:[A-Za-z0-9_]+]] = OpVariable %[[RAYTRACING_AS_PTR_TYPE]] UniformConstant
// CHECK-DAG: %[[RAY_PAYLOAD:[A-Za-z0-9_]+]] = OpVariable %{{.*}} RayPayloadKHR
// CHECK-DAG: %[[HIT_ATTR:[A-Za-z0-9_]+]] = OpVariable %{{.*}} HitObjectAttributeNV
// CHECK-DAG: %[[CALL_DATA:[A-Za-z0-9_]+]] = OpVariable %{{.*}} CallableDataKHR
// CHECK: OpLoad {{.*}} %[[RAYTRACING_AS]]
// CHECK: OpStore %[[RAY_PAYLOAD]]
// CHECK: OpStore %[[HIT_ATTR]]
// CHECK: OpStore %[[CALL_DATA]]
layout(binding = 0) uniform accelerationStructureEXT as;
buffer MyBlockName
{
uint data[];
} outputBuffer;
layout(location = 2) rayPayloadEXT vec4 payload;
layout(location = 2) hitObjectAttributeNV vec4 attrMain;
layout(location = 0) callableDataEXT vec4 outcall;
bool testHitObjectTraceRay() {
hitObjectNV hit;
hitObjectTraceRayNV(hit, as, gl_RayFlagsNoneEXT, 0xff, 0, 0, 0, vec3(0.1, 0.1, 0.0), 0.01f, vec3(0, 0, 1), 1e4f, 2);
return true
&& hitObjectIsHitNV(hit) == true
;
}
bool testPayloadReadWrite() {
payload = vec4(2);
vec4 read = payload;
return true
&& read != vec4(0)
;
}
bool testAttributeReadWrite() {
attrMain = vec4(2);
vec4 read = attrMain;
return true
&& read != vec4(0)
;
}
bool testCallableReadWrite() {
outcall = vec4(2);
vec4 read = outcall;
return true
&& read != vec4(0)
;
}
bool testReadWriteOfObjects(){
return true
&& testPayloadReadWrite()
&& testAttributeReadWrite()
&& testCallableReadWrite();
;
}
void main()
{
outputBuffer.data[0] = true
&& testHitObjectTraceRay()
&& testReadWriteOfObjects()
;
}
|