radv/bvh: Remove unused build_instance helper
This is in common code now. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32797>
This commit is contained in:
@@ -148,23 +148,6 @@ build_aabb(inout vk_aabb bounds, VOID_REF src_ptr, VOID_REF dst_ptr, uint32_t ge
|
||||
return is_valid;
|
||||
}
|
||||
|
||||
vk_aabb
|
||||
calculate_instance_node_bounds(radv_accel_struct_header header, mat3x4 otw_matrix)
|
||||
{
|
||||
vk_aabb aabb;
|
||||
for (uint32_t comp = 0; comp < 3; ++comp) {
|
||||
aabb.min[comp] = otw_matrix[comp][3];
|
||||
aabb.max[comp] = otw_matrix[comp][3];
|
||||
for (uint32_t col = 0; col < 3; ++col) {
|
||||
aabb.min[comp] +=
|
||||
min(otw_matrix[comp][col] * header.aabb.min[col], otw_matrix[comp][col] * header.aabb.max[col]);
|
||||
aabb.max[comp] +=
|
||||
max(otw_matrix[comp][col] * header.aabb.min[col], otw_matrix[comp][col] * header.aabb.max[col]);
|
||||
}
|
||||
}
|
||||
return aabb;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
encode_sbt_offset_and_flags(uint32_t src)
|
||||
{
|
||||
@@ -181,39 +164,6 @@ encode_sbt_offset_and_flags(uint32_t src)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
build_instance(inout vk_aabb bounds, VOID_REF src_ptr, VOID_REF dst_ptr, uint32_t global_id)
|
||||
{
|
||||
REF(radv_bvh_instance_node) node = REF(radv_bvh_instance_node)(dst_ptr);
|
||||
|
||||
AccelerationStructureInstance instance = DEREF(REF(AccelerationStructureInstance)(src_ptr));
|
||||
|
||||
/* An inactive instance is one whose acceleration structure handle is VK_NULL_HANDLE. Since the active terminology is
|
||||
* only relevant for BVH updates, which we do not implement, we can also skip instances with mask == 0.
|
||||
*/
|
||||
if (instance.accelerationStructureReference == 0 || instance.custom_instance_and_mask < (1u << 24u))
|
||||
return false;
|
||||
|
||||
radv_accel_struct_header instance_header =
|
||||
DEREF(REF(radv_accel_struct_header)(instance.accelerationStructureReference));
|
||||
|
||||
DEREF(node).bvh_ptr = addr_to_node(instance.accelerationStructureReference + instance_header.bvh_offset);
|
||||
DEREF(node).bvh_offset = instance_header.bvh_offset;
|
||||
|
||||
mat4 transform = mat4(instance.transform);
|
||||
mat4 inv_transform = transpose(inverse(transpose(transform)));
|
||||
DEREF(node).wto_matrix = mat3x4(inv_transform);
|
||||
DEREF(node).otw_matrix = mat3x4(transform);
|
||||
|
||||
bounds = calculate_instance_node_bounds(instance_header, mat3x4(transform));
|
||||
|
||||
DEREF(node).custom_instance_and_mask = instance.custom_instance_and_mask;
|
||||
DEREF(node).sbt_offset_and_flags = encode_sbt_offset_and_flags(instance.sbt_offset_and_flags);
|
||||
DEREF(node).instance_id = global_id;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Compute ceiling of integer quotient of A divided by B.
|
||||
From macros.h */
|
||||
#define DIV_ROUND_UP(A, B) (((A) + (B)-1) / (B))
|
||||
|
||||
Reference in New Issue
Block a user