blob: 93f8bb0f6fb65a856ad4bdf605cf55571551c990 (
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
|
//TEST:SIMPLE(filecheck=CHECK):-target glsl -profile glsl_450 -entry main -stage compute
//TEST:SIMPLE(filecheck=SPV):-target spirv -profile glsl_450 -entry main -stage compute -emit-spirv-via-glsl
//TEST:SIMPLE(filecheck=SPV):-target spirv -profile glsl_450 -entry main -stage compute -emit-spirv-directly
// SPV: OpMemoryModel PhysicalStorageBuffer64
// SPV: OpEntryPoint GLCompute {{.*}} "main" {{.*}}
// SPV: OpTypePointer PhysicalStorageBuffer
// SPV: OpConvertPtrToU
// SPV: OpINotEqual
struct MyStruct
{
float4 position;
float4x4 transform;
}
// CHECK: layout(buffer_reference, std430, buffer_reference_align = 4) buffer BufferPointer_MyStruct
// CHECK-NEXT: {
// CHECK-NEXT: MyStruct{{.*}} _data;
// CHECK-NEXT: }
// CHECK: struct ConstBufferPointer
// CHECK-NEXT: {
// CHECK-NEXT: BufferPointer_MyStruct{{.*}} _ptr
// CHECK-NEXT: }
struct Globals
{
ConstBufferPointer<MyStruct> pStruct;
}
ConstantBuffer<Globals> gGlobals;
RWStructuredBuffer<uint> outputBuffer;
[numthreads(1,1,1)]
void main(int3 tid: SV_DispatchThreadID)
{
if (gGlobals.pStruct.isValid())
{
MyStruct s = gGlobals.pStruct.get();
outputBuffer[tid.x] = uint(s.position.x);
MyStruct s1 = gGlobals.pStruct[3];
outputBuffer[tid.x + 1] = uint(s1.position.x);
}
}
|