radv: Use vk_acceleration_structure
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21047>
This commit is contained in:

committed by
Marge Bot

parent
eb33a1adb0
commit
4d2a7ea146
@@ -22,9 +22,9 @@
|
||||
*/
|
||||
|
||||
#include "util/u_process.h"
|
||||
#include "radv_acceleration_structure.h"
|
||||
#include "radv_meta.h"
|
||||
#include "radv_private.h"
|
||||
#include "vk_acceleration_structure.h"
|
||||
#include "vk_common_entrypoints.h"
|
||||
#include "wsi_common_entrypoints.h"
|
||||
|
||||
@@ -165,13 +165,15 @@ rra_CreateAccelerationStructureKHR(VkDevice _device,
|
||||
VkAccelerationStructureKHR *pAccelerationStructure)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
RADV_FROM_HANDLE(radv_buffer, buffer, pCreateInfo->buffer);
|
||||
|
||||
VkResult result = device->layer_dispatch.rra.CreateAccelerationStructureKHR(
|
||||
_device, pCreateInfo, pAllocator, pAccelerationStructure);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, structure, *pAccelerationStructure);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, structure, *pAccelerationStructure);
|
||||
simple_mtx_lock(&device->rra_trace.data_mtx);
|
||||
|
||||
struct radv_rra_accel_struct_data *data = calloc(1, sizeof(struct radv_rra_accel_struct_data));
|
||||
@@ -180,7 +182,7 @@ rra_CreateAccelerationStructureKHR(VkDevice _device,
|
||||
goto fail_as;
|
||||
}
|
||||
|
||||
data->va = structure->buffer->bo ? radv_acceleration_structure_get_va(structure) : 0;
|
||||
data->va = buffer->bo ? vk_acceleration_structure_get_va(structure) : 0;
|
||||
data->size = structure->size;
|
||||
data->type = pCreateInfo->type;
|
||||
data->is_dead = false;
|
||||
@@ -220,7 +222,7 @@ exit:
|
||||
|
||||
static void
|
||||
handle_accel_struct_write(VkCommandBuffer commandBuffer,
|
||||
struct radv_acceleration_structure *accel_struct,
|
||||
struct vk_acceleration_structure *accel_struct,
|
||||
struct radv_rra_accel_struct_data *data)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
@@ -244,7 +246,7 @@ handle_accel_struct_write(VkCommandBuffer commandBuffer,
|
||||
vk_common_CmdSetEvent(commandBuffer, data->build_event, 0);
|
||||
|
||||
if (!data->va) {
|
||||
data->va = radv_acceleration_structure_get_va(accel_struct);
|
||||
data->va = vk_acceleration_structure_get_va(accel_struct);
|
||||
_mesa_hash_table_u64_insert(cmd_buffer->device->rra_trace.accel_struct_vas, data->va,
|
||||
accel_struct);
|
||||
}
|
||||
@@ -260,7 +262,7 @@ handle_accel_struct_write(VkCommandBuffer commandBuffer,
|
||||
|
||||
VkCopyBufferInfo2 copyInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2,
|
||||
.srcBuffer = radv_buffer_to_handle(accel_struct->buffer),
|
||||
.srcBuffer = accel_struct->buffer,
|
||||
.dstBuffer = data->buffer,
|
||||
.regionCount = 1,
|
||||
.pRegions = ®ion,
|
||||
@@ -281,7 +283,7 @@ rra_CmdBuildAccelerationStructuresKHR(
|
||||
|
||||
simple_mtx_lock(&cmd_buffer->device->rra_trace.data_mtx);
|
||||
for (uint32_t i = 0; i < infoCount; ++i) {
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, structure, pInfos[i].dstAccelerationStructure);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, structure, pInfos[i].dstAccelerationStructure);
|
||||
struct hash_entry *entry = _mesa_hash_table_search(
|
||||
cmd_buffer->device->rra_trace.accel_structs, structure);
|
||||
|
||||
@@ -302,7 +304,7 @@ rra_CmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
|
||||
|
||||
simple_mtx_lock(&cmd_buffer->device->rra_trace.data_mtx);
|
||||
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, structure, pInfo->dst);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, structure, pInfo->dst);
|
||||
struct hash_entry *entry =
|
||||
_mesa_hash_table_search(cmd_buffer->device->rra_trace.accel_structs, structure);
|
||||
|
||||
@@ -324,7 +326,7 @@ rra_CmdCopyMemoryToAccelerationStructureKHR(VkCommandBuffer commandBuffer,
|
||||
|
||||
simple_mtx_lock(&cmd_buffer->device->rra_trace.data_mtx);
|
||||
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, structure, pInfo->dst);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, structure, pInfo->dst);
|
||||
struct hash_entry *entry =
|
||||
_mesa_hash_table_search(cmd_buffer->device->rra_trace.accel_structs, structure);
|
||||
|
||||
@@ -346,7 +348,7 @@ rra_DestroyAccelerationStructureKHR(VkDevice _device, VkAccelerationStructureKHR
|
||||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
simple_mtx_lock(&device->rra_trace.data_mtx);
|
||||
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, structure, _structure);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, structure, _structure);
|
||||
|
||||
struct hash_entry *entry =
|
||||
_mesa_hash_table_search(device->rra_trace.accel_structs, structure);
|
||||
|
@@ -59,7 +59,6 @@ libradv_files = files(
|
||||
'winsys/null/radv_null_winsys.c',
|
||||
'winsys/null/radv_null_winsys_public.h',
|
||||
'radv_acceleration_structure.c',
|
||||
'radv_acceleration_structure.h',
|
||||
'radv_android.c',
|
||||
'radv_cmd_buffer.c',
|
||||
'radv_cp_reg_shadowing.c',
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
#include "radv_acceleration_structure.h"
|
||||
|
||||
#include "radv_private.h"
|
||||
|
||||
#include "nir_builder.h"
|
||||
@@ -30,7 +30,9 @@
|
||||
#include "radix_sort/radv_radix_sort.h"
|
||||
|
||||
#include "bvh/build_interface.h"
|
||||
#include "bvh/bvh.h"
|
||||
|
||||
#include "vk_acceleration_structure.h"
|
||||
#include "vk_common_entrypoints.h"
|
||||
|
||||
static const uint32_t leaf_spv[] = {
|
||||
@@ -246,57 +248,6 @@ radv_GetAccelerationStructureBuildSizesKHR(
|
||||
pSizeInfo->buildScratchSize = scratch.size;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
radv_CreateAccelerationStructureKHR(VkDevice _device,
|
||||
const VkAccelerationStructureCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkAccelerationStructureKHR *pAccelerationStructure)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
RADV_FROM_HANDLE(radv_buffer, buffer, pCreateInfo->buffer);
|
||||
|
||||
struct radv_acceleration_structure *accel = vk_alloc2(
|
||||
&device->vk.alloc, pAllocator, sizeof(*accel), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (accel == NULL)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
vk_object_base_init(&device->vk, &accel->base, VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR);
|
||||
|
||||
accel->buffer = buffer;
|
||||
accel->offset = pCreateInfo->offset;
|
||||
accel->size = pCreateInfo->size;
|
||||
|
||||
if (pCreateInfo->deviceAddress && buffer->bo &&
|
||||
radv_acceleration_structure_get_va(accel) != pCreateInfo->deviceAddress)
|
||||
return vk_error(device, VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR);
|
||||
|
||||
*pAccelerationStructure = radv_acceleration_structure_to_handle(accel);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
radv_DestroyAccelerationStructureKHR(VkDevice _device,
|
||||
VkAccelerationStructureKHR accelerationStructure,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, accel, accelerationStructure);
|
||||
|
||||
if (!accel)
|
||||
return;
|
||||
|
||||
vk_object_base_finish(&accel->base);
|
||||
vk_free2(&device->vk.alloc, pAllocator, accel);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkDeviceAddress VKAPI_CALL
|
||||
radv_GetAccelerationStructureDeviceAddressKHR(
|
||||
VkDevice _device, const VkAccelerationStructureDeviceAddressInfoKHR *pInfo)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, accel, pInfo->accelerationStructure);
|
||||
return radv_acceleration_structure_get_va(accel);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
radv_WriteAccelerationStructuresPropertiesKHR(
|
||||
VkDevice _device, uint32_t accelerationStructureCount,
|
||||
@@ -368,8 +319,8 @@ radv_device_finish_accel_struct_build_state(struct radv_device *device)
|
||||
&state->alloc);
|
||||
radv_FreeMemory(radv_device_to_handle(device), state->accel_struct_build.null.memory,
|
||||
&state->alloc);
|
||||
radv_DestroyAccelerationStructureKHR(radv_device_to_handle(device),
|
||||
state->accel_struct_build.null.accel_struct, &state->alloc);
|
||||
vk_common_DestroyAccelerationStructureKHR(
|
||||
radv_device_to_handle(device), state->accel_struct_build.null.accel_struct, &state->alloc);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
@@ -548,8 +499,8 @@ radv_device_init_null_accel_struct(struct radv_device *device)
|
||||
.type = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR,
|
||||
};
|
||||
|
||||
result = radv_CreateAccelerationStructureKHR(_device, &create_info, &device->meta_state.alloc,
|
||||
&accel_struct);
|
||||
result = vk_common_CreateAccelerationStructureKHR(_device, &create_info,
|
||||
&device->meta_state.alloc, &accel_struct);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
@@ -936,8 +887,7 @@ encode_nodes(VkCommandBuffer commandBuffer, uint32_t infoCount,
|
||||
radv_CmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE,
|
||||
cmd_buffer->device->meta_state.accel_struct_build.encode_pipeline);
|
||||
for (uint32_t i = 0; i < infoCount; ++i) {
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, accel_struct,
|
||||
pInfos[i].dstAccelerationStructure);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, accel_struct, pInfos[i].dstAccelerationStructure);
|
||||
|
||||
VkGeometryTypeKHR geometry_type = VK_GEOMETRY_TYPE_TRIANGLES_KHR;
|
||||
|
||||
@@ -950,8 +900,8 @@ encode_nodes(VkCommandBuffer commandBuffer, uint32_t infoCount,
|
||||
|
||||
const struct encode_args args = {
|
||||
.intermediate_bvh = pInfos[i].scratchData.deviceAddress + bvh_states[i].scratch.ir_offset,
|
||||
.output_bvh = radv_acceleration_structure_get_va(accel_struct) +
|
||||
bvh_states[i].accel_struct.bvh_offset,
|
||||
.output_bvh =
|
||||
vk_acceleration_structure_get_va(accel_struct) + bvh_states[i].accel_struct.bvh_offset,
|
||||
.header = pInfos[i].scratchData.deviceAddress + bvh_states[i].scratch.header_offset,
|
||||
.output_bvh_offset = bvh_states[i].accel_struct.bvh_offset,
|
||||
.leaf_node_count = bvh_states[i].leaf_node_count,
|
||||
@@ -1044,8 +994,7 @@ radv_CmdBuildAccelerationStructuresKHR(
|
||||
encode_nodes(commandBuffer, infoCount, pInfos, bvh_states);
|
||||
|
||||
for (uint32_t i = 0; i < infoCount; ++i) {
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, accel_struct,
|
||||
pInfos[i].dstAccelerationStructure);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, accel_struct, pInfos[i].dstAccelerationStructure);
|
||||
const size_t base = offsetof(struct radv_accel_struct_header, compacted_size);
|
||||
struct radv_accel_struct_header header;
|
||||
|
||||
@@ -1087,12 +1036,12 @@ radv_CmdBuildAccelerationStructuresKHR(
|
||||
geometry_infos[j].primitive_count = ppBuildRangeInfos[i][j].primitiveCount;
|
||||
}
|
||||
|
||||
radv_update_buffer_cp(cmd_buffer, radv_acceleration_structure_get_va(accel_struct) + base,
|
||||
radv_update_buffer_cp(cmd_buffer, vk_acceleration_structure_get_va(accel_struct) + base,
|
||||
(const char *)&header + base, sizeof(header) - base);
|
||||
|
||||
VkDeviceSize geometry_infos_offset = header.compacted_size - geometry_infos_size;
|
||||
|
||||
radv_CmdUpdateBuffer(commandBuffer, radv_buffer_to_handle(accel_struct->buffer),
|
||||
radv_CmdUpdateBuffer(commandBuffer, accel_struct->buffer,
|
||||
accel_struct->offset + geometry_infos_offset, geometry_infos_size,
|
||||
geometry_infos);
|
||||
|
||||
@@ -1109,8 +1058,9 @@ radv_CmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
|
||||
const VkCopyAccelerationStructureInfoKHR *pInfo)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, src, pInfo->src);
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, dst, pInfo->dst);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, src, pInfo->src);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, dst, pInfo->dst);
|
||||
RADV_FROM_HANDLE(radv_buffer, src_buffer, src->buffer);
|
||||
struct radv_meta_saved_state saved_state;
|
||||
|
||||
VkResult result = radv_device_init_accel_struct_copy_state(cmd_buffer->device);
|
||||
@@ -1127,8 +1077,8 @@ radv_CmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
|
||||
cmd_buffer->device->meta_state.accel_struct_build.copy_pipeline);
|
||||
|
||||
struct copy_args consts = {
|
||||
.src_addr = radv_acceleration_structure_get_va(src),
|
||||
.dst_addr = radv_acceleration_structure_get_va(dst),
|
||||
.src_addr = vk_acceleration_structure_get_va(src),
|
||||
.dst_addr = vk_acceleration_structure_get_va(dst),
|
||||
.mode = RADV_COPY_MODE_COPY,
|
||||
};
|
||||
|
||||
@@ -1139,8 +1089,8 @@ radv_CmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
|
||||
cmd_buffer->state.flush_bits |=
|
||||
radv_dst_access_flush(cmd_buffer, VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT, NULL);
|
||||
|
||||
radv_indirect_dispatch(cmd_buffer, src->buffer->bo,
|
||||
radv_acceleration_structure_get_va(src) +
|
||||
radv_indirect_dispatch(cmd_buffer, src_buffer->bo,
|
||||
vk_acceleration_structure_get_va(src) +
|
||||
offsetof(struct radv_accel_struct_header, copy_dispatch_size));
|
||||
radv_meta_restore(&saved_state, cmd_buffer);
|
||||
}
|
||||
@@ -1182,7 +1132,7 @@ radv_CmdCopyMemoryToAccelerationStructureKHR(
|
||||
VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, dst, pInfo->dst);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, dst, pInfo->dst);
|
||||
struct radv_meta_saved_state saved_state;
|
||||
|
||||
VkResult result = radv_device_init_accel_struct_copy_state(cmd_buffer->device);
|
||||
@@ -1200,7 +1150,7 @@ radv_CmdCopyMemoryToAccelerationStructureKHR(
|
||||
|
||||
const struct copy_args consts = {
|
||||
.src_addr = pInfo->src.deviceAddress,
|
||||
.dst_addr = radv_acceleration_structure_get_va(dst),
|
||||
.dst_addr = vk_acceleration_structure_get_va(dst),
|
||||
.mode = RADV_COPY_MODE_DESERIALIZE,
|
||||
};
|
||||
|
||||
@@ -1217,7 +1167,8 @@ radv_CmdCopyAccelerationStructureToMemoryKHR(
|
||||
VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, src, pInfo->src);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, src, pInfo->src);
|
||||
RADV_FROM_HANDLE(radv_buffer, src_buffer, src->buffer);
|
||||
struct radv_meta_saved_state saved_state;
|
||||
|
||||
VkResult result = radv_device_init_accel_struct_copy_state(cmd_buffer->device);
|
||||
@@ -1234,7 +1185,7 @@ radv_CmdCopyAccelerationStructureToMemoryKHR(
|
||||
cmd_buffer->device->meta_state.accel_struct_build.copy_pipeline);
|
||||
|
||||
const struct copy_args consts = {
|
||||
.src_addr = radv_acceleration_structure_get_va(src),
|
||||
.src_addr = vk_acceleration_structure_get_va(src),
|
||||
.dst_addr = pInfo->dst.deviceAddress,
|
||||
.mode = RADV_COPY_MODE_SERIALIZE,
|
||||
};
|
||||
@@ -1246,8 +1197,8 @@ radv_CmdCopyAccelerationStructureToMemoryKHR(
|
||||
cmd_buffer->state.flush_bits |=
|
||||
radv_dst_access_flush(cmd_buffer, VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT, NULL);
|
||||
|
||||
radv_indirect_dispatch(cmd_buffer, src->buffer->bo,
|
||||
radv_acceleration_structure_get_va(src) +
|
||||
radv_indirect_dispatch(cmd_buffer, src_buffer->bo,
|
||||
vk_acceleration_structure_get_va(src) +
|
||||
offsetof(struct radv_accel_struct_header, copy_dispatch_size));
|
||||
radv_meta_restore(&saved_state, cmd_buffer);
|
||||
|
||||
@@ -1269,10 +1220,3 @@ radv_CmdBuildAccelerationStructuresIndirectKHR(
|
||||
{
|
||||
unreachable("Unimplemented");
|
||||
}
|
||||
|
||||
uint64_t
|
||||
radv_acceleration_structure_get_va(struct radv_acceleration_structure *accel_struct)
|
||||
{
|
||||
return radv_buffer_get_va(accel_struct->buffer->bo) + accel_struct->buffer->offset +
|
||||
accel_struct->offset;
|
||||
}
|
||||
|
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 Bas Nieuwenhuizen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef RADV_ACCELERATION_STRUCTURE_H
|
||||
#define RADV_ACCELERATION_STRUCTURE_H
|
||||
|
||||
#include "bvh/bvh.h"
|
||||
|
||||
#include "radv_private.h"
|
||||
|
||||
struct radv_acceleration_structure {
|
||||
struct vk_object_base base;
|
||||
|
||||
struct radv_buffer *buffer;
|
||||
uint64_t offset;
|
||||
uint64_t size;
|
||||
};
|
||||
|
||||
uint64_t radv_acceleration_structure_get_va(struct radv_acceleration_structure *accel_struct);
|
||||
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(radv_acceleration_structure, base, VkAccelerationStructureKHR,
|
||||
VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR)
|
||||
|
||||
#endif
|
@@ -27,9 +27,9 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "util/mesa-sha1.h"
|
||||
#include "radv_acceleration_structure.h"
|
||||
#include "radv_private.h"
|
||||
#include "sid.h"
|
||||
#include "vk_acceleration_structure.h"
|
||||
#include "vk_descriptors.h"
|
||||
#include "vk_format.h"
|
||||
#include "vk_util.h"
|
||||
@@ -1303,9 +1303,9 @@ static ALWAYS_INLINE void
|
||||
write_accel_struct(struct radv_device *device, void *ptr, VkDeviceAddress va)
|
||||
{
|
||||
if (!va) {
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, accel_struct,
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, accel_struct,
|
||||
device->meta_state.accel_struct_build.null.accel_struct);
|
||||
va = radv_acceleration_structure_get_va(accel_struct);
|
||||
va = vk_acceleration_structure_get_va(accel_struct);
|
||||
}
|
||||
|
||||
memcpy(ptr, &va, sizeof(va));
|
||||
@@ -1403,11 +1403,11 @@ radv_update_descriptor_sets_impl(struct radv_device *device, struct radv_cmd_buf
|
||||
}
|
||||
break;
|
||||
case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: {
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, accel_struct,
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, accel_struct,
|
||||
accel_structs->pAccelerationStructures[j]);
|
||||
|
||||
write_accel_struct(device, ptr,
|
||||
accel_struct ? radv_acceleration_structure_get_va(accel_struct) : 0);
|
||||
accel_struct ? vk_acceleration_structure_get_va(accel_struct) : 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -1701,10 +1701,10 @@ radv_update_descriptor_set_with_template_impl(struct radv_device *device,
|
||||
memcpy(pDst, templ->entry[i].immutable_samplers + 4 * j, 16);
|
||||
break;
|
||||
case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: {
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, accel_struct,
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, accel_struct,
|
||||
*(const VkAccelerationStructureKHR *)pSrc);
|
||||
write_accel_struct(device, pDst,
|
||||
accel_struct ? radv_acceleration_structure_get_va(accel_struct) : 0);
|
||||
accel_struct ? vk_acceleration_structure_get_va(accel_struct) : 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "util/hash_table.h"
|
||||
|
||||
#include "radv_acceleration_structure.h"
|
||||
#include "bvh/bvh.h"
|
||||
#include "radv_private.h"
|
||||
#include "radv_rt_common.h"
|
||||
#include "radv_shader.h"
|
||||
|
@@ -28,14 +28,15 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bvh/bvh.h"
|
||||
#include "nir/nir_builder.h"
|
||||
#include "util/u_atomic.h"
|
||||
#include "vulkan/vulkan_core.h"
|
||||
#include "radv_acceleration_structure.h"
|
||||
#include "radv_cs.h"
|
||||
#include "radv_meta.h"
|
||||
#include "radv_private.h"
|
||||
#include "sid.h"
|
||||
#include "vk_acceleration_structure.h"
|
||||
|
||||
#define TIMESTAMP_NOT_READY UINT64_MAX
|
||||
|
||||
@@ -2181,8 +2182,8 @@ radv_CmdWriteAccelerationStructuresPropertiesKHR(
|
||||
radeon_check_space(cmd_buffer->device->ws, cs, 6 * accelerationStructureCount);
|
||||
|
||||
for (uint32_t i = 0; i < accelerationStructureCount; ++i) {
|
||||
RADV_FROM_HANDLE(radv_acceleration_structure, accel_struct, pAccelerationStructures[i]);
|
||||
uint64_t va = radv_acceleration_structure_get_va(accel_struct);
|
||||
RADV_FROM_HANDLE(vk_acceleration_structure, accel_struct, pAccelerationStructures[i]);
|
||||
uint64_t va = vk_acceleration_structure_get_va(accel_struct);
|
||||
|
||||
switch (queryType) {
|
||||
case VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR:
|
||||
|
@@ -21,8 +21,10 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "bvh/bvh.h"
|
||||
#include "amd_family.h"
|
||||
#include "radv_acceleration_structure.h"
|
||||
#include "radv_private.h"
|
||||
#include "vk_acceleration_structure.h"
|
||||
#include "vk_common_entrypoints.h"
|
||||
|
||||
#define RRA_MAGIC 0x204644525F444D41
|
||||
@@ -1063,7 +1065,7 @@ rra_map_accel_struct_data(struct rra_copy_context *ctx, uint32_t i)
|
||||
return mapped_data;
|
||||
}
|
||||
|
||||
const struct radv_acceleration_structure *accel_struct = ctx->entries[i]->key;
|
||||
const struct vk_acceleration_structure *accel_struct = ctx->entries[i]->key;
|
||||
VkResult result;
|
||||
|
||||
VkCommandBufferBeginInfo begin_info = {
|
||||
@@ -1081,7 +1083,7 @@ rra_map_accel_struct_data(struct rra_copy_context *ctx, uint32_t i)
|
||||
|
||||
VkCopyBufferInfo2 copy_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2,
|
||||
.srcBuffer = radv_buffer_to_handle(accel_struct->buffer),
|
||||
.srcBuffer = accel_struct->buffer,
|
||||
.dstBuffer = ctx->buffer,
|
||||
.regionCount = 1,
|
||||
.pRegions = ©,
|
||||
|
@@ -21,9 +21,9 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "radv_debug.h"
|
||||
#include "radv_rt_common.h"
|
||||
#include "radv_acceleration_structure.h"
|
||||
#include "bvh/bvh.h"
|
||||
#include "radv_debug.h"
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#include <llvm/Config/llvm-config.h>
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include "nir/nir.h"
|
||||
#include "nir/nir_builder.h"
|
||||
|
||||
#include "radv_acceleration_structure.h"
|
||||
#include "bvh/bvh.h"
|
||||
#include "radv_meta.h"
|
||||
#include "radv_private.h"
|
||||
#include "radv_rt_common.h"
|
||||
|
Reference in New Issue
Block a user