blob: 7d4e5dc1c1cdb2205f25ea8a14ace96d582915a4 (
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
|
//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -O0
// Note: spirv-opt will crash on the generated spirv, so use -O0 to disable it.
// CHECK: OpEntryPoint
// CHECK: OpTypeForwardPointer
typedef vk::BufferPointer<block_s> block_p;
struct block_s
{
float4 x;
block_p next;
};
struct TestPushConstant_t
{
block_p root;
};
[[vk::push_constant]] TestPushConstant_t g_PushConstants;
[shader("fragment")]
float4 MainPs(void) : SV_Target0
{
#if __has_feature(hlsl_vk_buffer_pointer)
block_p g_p = g_PushConstants.root;
g_p = g_p.Get().next;
if ((uint64_t)g_p == 0) // Null pointer test
return float4(0.0, 0.0, 0.0, 0.0);
return g_p.Get().x;
#else
return float4(0.0);
#endif
}
|