diff options
| author | Yong He <yonghe@outlook.com> | 2023-08-10 14:58:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-10 14:58:41 -0700 |
| commit | 38b0af3537f5d8412f0d69e39e38c5603ff62c15 (patch) | |
| tree | 5892b0b2427f0de0057259949e03105ec766143a /tests | |
| parent | 60ebadab1ec269c7017148a028307a9b5f32b1d4 (diff) | |
Add support for ConstBufferPointer on Vulkan. (#3089)
* Add support for `ConstBufferPointer` on Vulkan.
* Add spv compilation test.
* Fix.
* Fix code review issues.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/hlsl-intrinsic/const-buffer-pointer.slang | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/hlsl-intrinsic/const-buffer-pointer.slang b/tests/hlsl-intrinsic/const-buffer-pointer.slang new file mode 100644 index 000000000..33b538a60 --- /dev/null +++ b/tests/hlsl-intrinsic/const-buffer-pointer.slang @@ -0,0 +1,39 @@ +//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 + +// SPV: EntryPoint GLCompute {{.*}} "main" {{.*}} + +struct MyStruct +{ + float4 position; + float4x4 transform; +} + +// CHECK: layout(buffer_reference, std430, buffer_reference_align = 16) readonly buffer BufferPointer_MyStruct +// CHECK-NEXT: { +// CHECK-NEXT: MyStruct{{.*}} _data; +// CHECK-NEXT: } + +// CHECK: struct Globals +// CHECK-NEXT: { +// CHECK-NEXT: BufferPointer_MyStruct{{.*}} pStruct +// CHECK-NEXT: } + +// CHECK: void main +// CHECK: MyStruct{{.*}} s{{.*}} = ((gGlobals{{.*}}.pStruct{{.*}})._data); + +struct Globals +{ + ConstBufferPointer<MyStruct> pStruct; +} + +ConstantBuffer<Globals> gGlobals; + +RWStructuredBuffer<uint> outputBuffer; + +[numthreads(1,1,1)] +void main(int3 tid: SV_DispatchThreadID) +{ + MyStruct s = gGlobals.pStruct.get(); + outputBuffer[tid.x] = uint(s.position.x); +}
\ No newline at end of file |
