mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-25 15:40:46 +02:00
radv: Add and use RADV_OFFSET_UNUSED
This deduplicates the logic to figure out what needs to be written. Reviewed-by: Natalie Vock <natalie.vock@gmx.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35445>
This commit is contained in:
parent
1dda9d56cb
commit
703a154f29
1 changed files with 5 additions and 1 deletions
|
|
@ -48,6 +48,8 @@ static const uint32_t leaf_spv[] = {
|
|||
#include "bvh/radv_leaf.spv.h"
|
||||
};
|
||||
|
||||
#define RADV_OFFSET_UNUSED 0xffffffff
|
||||
|
||||
struct acceleration_structure_layout {
|
||||
uint32_t geometry_info_offset;
|
||||
uint32_t leaf_node_offsets_offset;
|
||||
|
|
@ -123,6 +125,8 @@ radv_get_acceleration_structure_layout(struct radv_device *device,
|
|||
if (device->rra_trace.accel_structs) {
|
||||
accel_struct->geometry_info_offset = offset;
|
||||
offset += sizeof(struct radv_accel_struct_geometry_info) * state->build_info->geometryCount;
|
||||
} else {
|
||||
accel_struct->geometry_info_offset = RADV_OFFSET_UNUSED;
|
||||
}
|
||||
|
||||
/* On GFX12, we need additional space for leaf node offsets since they do not have the same
|
||||
|
|
@ -512,7 +516,7 @@ radv_init_header(VkCommandBuffer commandBuffer, const struct vk_acceleration_str
|
|||
radv_update_memory_cp(cmd_buffer, vk_acceleration_structure_get_va(dst) + base, (const char *)&header + base,
|
||||
sizeof(header) - base);
|
||||
|
||||
if (device->rra_trace.accel_structs) {
|
||||
if (layout.geometry_info_offset != RADV_OFFSET_UNUSED) {
|
||||
uint64_t geometry_infos_size = state->build_info->geometryCount * sizeof(struct radv_accel_struct_geometry_info);
|
||||
|
||||
struct radv_accel_struct_geometry_info *geometry_infos = malloc(geometry_infos_size);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue