From 1406aa2bc9e398e5e5565ba9c6adbb780c29fee1 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 13 Dec 2023 12:24:27 -0800 Subject: Add spirv intrinsics for `ConstBufferPointer`. (#3407) Fixes #3305. Fixes #3404. Co-authored-by: Yong He --- tests/hlsl-intrinsic/const-buffer-pointer.slang | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tests/hlsl-intrinsic/const-buffer-pointer.slang') diff --git a/tests/hlsl-intrinsic/const-buffer-pointer.slang b/tests/hlsl-intrinsic/const-buffer-pointer.slang index eddfc3be0..ec242fa07 100644 --- a/tests/hlsl-intrinsic/const-buffer-pointer.slang +++ b/tests/hlsl-intrinsic/const-buffer-pointer.slang @@ -1,8 +1,10 @@ //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 - +//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: OpINotEqual struct MyStruct { float4 position; @@ -34,6 +36,9 @@ RWStructuredBuffer outputBuffer; [numthreads(1,1,1)] void main(int3 tid: SV_DispatchThreadID) { - MyStruct s = gGlobals.pStruct.get(); - outputBuffer[tid.x] = uint(s.position.x); + if (gGlobals.pStruct.isValid()) + { + MyStruct s = gGlobals.pStruct.get(); + outputBuffer[tid.x] = uint(s.position.x); + } } -- cgit v1.2.3