From 38b0af3537f5d8412f0d69e39e38c5603ff62c15 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 10 Aug 2023 14:58:41 -0700 Subject: 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 --- tests/hlsl-intrinsic/const-buffer-pointer.slang | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/hlsl-intrinsic/const-buffer-pointer.slang (limited to 'tests') 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 pStruct; +} + +ConstantBuffer gGlobals; + +RWStructuredBuffer 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 -- cgit v1.2.3