Skip to content

Commit

Permalink
Add missing buffer usage flags to ray tracing acceleration structures (
Browse files Browse the repository at this point in the history
…#1022)

Fixes #948
  • Loading branch information
SaschaWillems committed May 6, 2024
1 parent ec7fc61 commit 234bc13
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion framework/core/acceleration_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void AccelerationStructure::build(VkQueue queue, VkBuildAccelerationStructureFla
buffer = std::make_unique<vkb::core::Buffer>(
device,
build_sizes_info.accelerationStructureSize,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
VMA_MEMORY_USAGE_GPU_ONLY);

VkAccelerationStructureCreateInfoKHR acceleration_structure_create_info{};
Expand Down
4 changes: 2 additions & 2 deletions samples/extensions/ray_tracing_basic/ray_tracing_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void RaytracingBasic::create_bottom_level_acceleration_structure()
bottom_level_acceleration_structure.buffer = std::make_unique<vkb::core::Buffer>(
get_device(),
acceleration_structure_build_sizes_info.accelerationStructureSize,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
VMA_MEMORY_USAGE_GPU_ONLY);

// Create the acceleration structure
Expand Down Expand Up @@ -383,7 +383,7 @@ void RaytracingBasic::create_top_level_acceleration_structure()
top_level_acceleration_structure.buffer = std::make_unique<vkb::core::Buffer>(
get_device(),
acceleration_structure_build_sizes_info.accelerationStructureSize,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
VMA_MEMORY_USAGE_GPU_ONLY);

// Create the acceleration structure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ void RaytracingExtended::create_bottom_level_acceleration_structure(bool is_upda
bottom_level_acceleration_structure.buffer = std::make_unique<vkb::core::Buffer>(
get_device(),
model_buffer.buildSize.accelerationStructureSize,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
VMA_MEMORY_USAGE_GPU_ONLY);
}
if (!is_update && bottom_level_acceleration_structure.handle == nullptr)
Expand Down Expand Up @@ -698,7 +698,7 @@ void RaytracingExtended::create_top_level_acceleration_structure(bool print_time
top_level_acceleration_structure.buffer = std::make_unique<vkb::core::Buffer>(
get_device(),
acceleration_structure_build_sizes_info.accelerationStructureSize,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
VMA_MEMORY_USAGE_GPU_ONLY);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void RaytracingReflection::create_bottom_level_acceleration_structure(ObjModelGp

// Create a buffer to hold the acceleration structure
AccelerationStructure blas;
blas.buffer = std::make_unique<vkb::core::Buffer>(get_device(), acceleration_structure_build_sizes_info.accelerationStructureSize, VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR, VMA_MEMORY_USAGE_GPU_ONLY);
blas.buffer = std::make_unique<vkb::core::Buffer>(get_device(), acceleration_structure_build_sizes_info.accelerationStructureSize, VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, VMA_MEMORY_USAGE_GPU_ONLY);

// Create the acceleration structure
VkAccelerationStructureCreateInfoKHR acceleration_structure_create_info{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR};
Expand Down Expand Up @@ -348,7 +348,7 @@ void RaytracingReflection::create_top_level_acceleration_structure(std::vector<V
top_level_acceleration_structure.buffer = std::make_unique<vkb::core::Buffer>(
get_device(),
acceleration_structure_build_sizes_info.accelerationStructureSize,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR,
VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
VMA_MEMORY_USAGE_GPU_ONLY);

// Create the acceleration structure
Expand Down

0 comments on commit 234bc13

Please sign in to comment.