From 8e265ef5edc155dd8a965207de875d36f0c90bbb Mon Sep 17 00:00:00 2001 From: httpdigest Date: Wed, 24 Jul 2024 15:11:30 +0200 Subject: [PATCH] Fix usage flags for buffers whose device addresses are queried --- .../lwjgl/demo/vulkan/raytracing/SimpleTriangleRayQuery.java | 3 ++- src/org/lwjgl/demo/vulkan/raytracing/VoxelChunks.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/org/lwjgl/demo/vulkan/raytracing/SimpleTriangleRayQuery.java b/src/org/lwjgl/demo/vulkan/raytracing/SimpleTriangleRayQuery.java index b7c4c05d..6ad75fd1 100644 --- a/src/org/lwjgl/demo/vulkan/raytracing/SimpleTriangleRayQuery.java +++ b/src/org/lwjgl/demo/vulkan/raytracing/SimpleTriangleRayQuery.java @@ -1026,7 +1026,8 @@ private static AccelerationStructure createBottomLevelAccelerationStructure( // Create a buffer that will hold the final BLAS AllocationAndBuffer accelerationStructureBuffer = createBuffer( - VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR, buildSizesInfo.accelerationStructureSize(), + VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | + VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR, buildSizesInfo.accelerationStructureSize(), null, 256, null); // Create a BLAS object (not currently built) diff --git a/src/org/lwjgl/demo/vulkan/raytracing/VoxelChunks.java b/src/org/lwjgl/demo/vulkan/raytracing/VoxelChunks.java index 7492c16c..b4e84e22 100644 --- a/src/org/lwjgl/demo/vulkan/raytracing/VoxelChunks.java +++ b/src/org/lwjgl/demo/vulkan/raytracing/VoxelChunks.java @@ -1192,7 +1192,7 @@ private static void createBottomLevelAccelerationStructures(List chunks) // Create a scratch buffer for the BLAS build AllocationAndBuffer scratchBuffer = createBuffer( VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR | - VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, totalScratchBufferSize, null, + VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, totalScratchBufferSize, null, deviceAndQueueFamilies.minAccelerationStructureScratchOffsetAlignment, null); // Create the BLAS and fill in device addresses for the above two buffers with their offsets