mesa/src/intel/vulkan/bvh/header.comp
Sagar Ghuge 87f7f0f039 anv/rt: Drop header update using blorp code path
Updating header using blorp code path involves setting up the render
surface state. Header (CPU) update code path involves
compute_w_to_host_r barrier which involves heavy flushing. Switching to
completely shader based header update avoid all that overhead.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39971>
2026-03-18 03:49:17 +00:00

49 lines
1.4 KiB
Text

/* Copyright © 2024 Valve Corporation
* Copyright © 2024 Intel Corporation
* SPDX-License-Identifier: MIT
*/
#version 460
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
#include "anv_build_interface.h"
layout(push_constant) uniform CONSTS
{
header_args args;
};
void
main(void)
{
uint64_t compacted_size = args.bvh_size;
if (args.is_compacted == uint8_t(1)) {
compacted_size =
args.bvh_offset + DEREF(args.src).dst_node_offset * ANV_RT_BLOCK_SIZE;
}
uint64_t serialization_size = compacted_size +
SIZEOF(vk_accel_struct_serialization_header) + SIZEOF(uint64_t) *
args.instance_count;
DEREF(args.dst).compacted_size = compacted_size;
DEREF(args.dst).size = compacted_size;
DEREF(args.dst).serialization_size = serialization_size;
DEREF(args.dst).self_ptr = uint64_t(args.dst);
DEREF(args.dst).instance_count = args.instance_count;
DEREF(args.dst).instance_leaves_offset = args.instance_leaves_offset;
/* 128 is local_size_x in copy.comp shader, 8 is the amount of data
* copied by each iteration of that shader's loop
*/
DEREF(args.dst).copy_dispatch_size[0] =
uint32_t(DIV_ROUND_UP(compacted_size, 8 * 128));
DEREF(args.dst).copy_dispatch_size[1] = 1;
DEREF(args.dst).copy_dispatch_size[2] = 1;
#if GFX_VERx10 >= 300
DEREF(args.dst).enable_64b_rt = 1;
#else
DEREF(args.dst).enable_64b_rt = 0;
#endif
}