Skip to content

Commit 68d199f

Browse files
committed
Fix initialization of counter handle.
1 parent 496aaf5 commit 68d199f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ static void createResourceInitFn(CodeGenModule &CGM, llvm::GlobalVariable *GV,
558558
// TODO(124561): This needs to be updated to get the correct slot for
559559
// SPIR-V. Using a placeholder value for now.
560560
uint32_t CounterSlot = (CGM.getTriple().isSPIRV() ? Slot + 1 : Slot);
561-
CreateAndStoreHandle(GV, CounterSlot, Space, 0, CGM, Builder);
561+
CreateAndStoreHandle(GV, CounterSlot, Space, 1, CGM, Builder);
562562
}
563563

564564
Builder.CreateRetVoid();

clang/test/CodeGenHLSL/builtins/StructuredBuffers-constructors.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ RasterizerOrderedStructuredBuffer<float> Buf5 : register(u1, space2);
4141
// CHECK-DXIL: store target("dx.RawBuffer", float, 1, 0) [[H]], ptr getelementptr inbounds nuw (%"class.hlsl::RWStructuredBuffer", ptr @_ZL4Buf2, i32 0, i32 1), align 1
4242
// CHECK-SPIRV: [[H:%.*]] = call target("spirv.VulkanBuffer", [0 x float], 12, 1) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0f32_12_1t(i32 1, i32 5, i32 1, i32 0, i1 false)
4343
// CHECK-SPIRV: store target("spirv.VulkanBuffer", [0 x float], 12, 1) [[H]], ptr @_ZL4Buf2, align 8
44-
// CHECK-SPIRV: [[H:%.*]] = call target("spirv.VulkanBuffer", [0 x float], 12, 1) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0f32_12_1t(i32 1, i32 6, i32 1, i32 0, i1 false)
45-
// CHECK-SPIRV: store target("spirv.VulkanBuffer", [0 x float], 12, 1) [[H]], ptr getelementptr inbounds nuw (%"class.hlsl::RWStructuredBuffer", ptr @_ZL4Buf2, i32 0, i32 1), align 1
44+
// CHECK-SPIRV: [[H:%.*]] = call target("spirv.VulkanBuffer", i32, 2, 1) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0f32_12_1t(i32 1, i32 6, i32 1, i32 0, i1 false)
45+
// CHECK-SPIRV: store target("spirv.VulkanBuffer", i32, 2, 1) [[H]], ptr getelementptr inbounds nuw (%"class.hlsl::RWStructuredBuffer", ptr @_ZL4Buf2, i32 0, i32 1), align 1
4646

4747

4848
// CHECK-DXIL: define internal void @_init_resource__ZL4Buf3()

0 commit comments

Comments
 (0)