mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-26 08:50:34 +01:00
vulkan: add support for vkCreateAccelerationStructure2KHR()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40385>
This commit is contained in:
parent
730054ca47
commit
217dc750e7
2 changed files with 29 additions and 2 deletions
|
|
@ -93,6 +93,28 @@ vk_common_CreateAccelerationStructureKHR(VkDevice _device,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vk_common_CreateAccelerationStructure2KHR(VkDevice _device,
|
||||
const VkAccelerationStructureCreateInfo2KHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkAccelerationStructureKHR *pAccelerationStructure)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_device, device, _device);
|
||||
|
||||
struct vk_acceleration_structure *accel_struct = vk_object_zalloc(
|
||||
device, pAllocator, sizeof(struct vk_acceleration_structure),
|
||||
VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR);
|
||||
|
||||
if (!accel_struct)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
accel_struct->addr = pCreateInfo->addressRange.address;
|
||||
accel_struct->size = pCreateInfo->addressRange.size;
|
||||
|
||||
*pAccelerationStructure = vk_acceleration_structure_to_handle(accel_struct);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
vk_common_DestroyAccelerationStructureKHR(VkDevice _device,
|
||||
VkAccelerationStructureKHR accelerationStructure,
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ struct vk_acceleration_structure {
|
|||
|
||||
struct vk_buffer *buffer;
|
||||
|
||||
uint64_t addr;
|
||||
uint64_t offset;
|
||||
uint64_t size;
|
||||
};
|
||||
|
|
@ -76,8 +77,12 @@ struct vk_acceleration_structure {
|
|||
static inline VkDeviceAddress
|
||||
vk_acceleration_structure_get_va(const struct vk_acceleration_structure *accel_struct)
|
||||
{
|
||||
assert(accel_struct->buffer != NULL);
|
||||
return vk_buffer_address(accel_struct->buffer, accel_struct->offset);
|
||||
if (accel_struct->buffer) {
|
||||
return vk_buffer_address(accel_struct->buffer, accel_struct->offset);
|
||||
} else {
|
||||
assert(accel_struct->addr != 0);
|
||||
return accel_struct->addr;
|
||||
}
|
||||
}
|
||||
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(vk_acceleration_structure, base, VkAccelerationStructureKHR,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue