mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 13:10:10 +01:00
radv/bvh: Add radv_aabb16 and use it for box16 nodes
This commit is contained in:
parent
9a4e00a925
commit
4950f6e23d
2 changed files with 14 additions and 4 deletions
|
|
@ -34,6 +34,7 @@
|
|||
#else
|
||||
#include <vulkan/vulkan.h>
|
||||
typedef uint16_t float16_t;
|
||||
typedef struct radv_aabb16 radv_aabb16;
|
||||
#endif
|
||||
|
||||
struct radv_accel_struct_serialization_header {
|
||||
|
|
@ -112,9 +113,18 @@ struct radv_bvh_instance_node {
|
|||
mat3x4 otw_matrix;
|
||||
};
|
||||
|
||||
struct radv_aabb16 {
|
||||
float16_t min_x;
|
||||
float16_t min_y;
|
||||
float16_t min_z;
|
||||
float16_t max_x;
|
||||
float16_t max_y;
|
||||
float16_t max_z;
|
||||
};
|
||||
|
||||
struct radv_bvh_box16_node {
|
||||
uint32_t children[4];
|
||||
float16_t coords[4][2][3];
|
||||
radv_aabb16 coords[4];
|
||||
};
|
||||
|
||||
struct radv_bvh_box32_node {
|
||||
|
|
|
|||
|
|
@ -376,9 +376,9 @@ radv_gather_bvh_stats_gfx10_3(const uint8_t *bvh, uint32_t node_id, uint32_t dep
|
|||
for (uint32_t i = 0; i < 4; i++) {
|
||||
if (box16->children[i] != 0xffffffff) {
|
||||
float extent[3] = {
|
||||
_mesa_half_to_float(box16->coords[i][1][0]) - _mesa_half_to_float(box16->coords[i][0][0]),
|
||||
_mesa_half_to_float(box16->coords[i][1][1]) - _mesa_half_to_float(box16->coords[i][0][1]),
|
||||
_mesa_half_to_float(box16->coords[i][1][2]) - _mesa_half_to_float(box16->coords[i][0][2]),
|
||||
_mesa_half_to_float(box16->coords[i].max_x) - _mesa_half_to_float(box16->coords[i].min_x),
|
||||
_mesa_half_to_float(box16->coords[i].max_y) - _mesa_half_to_float(box16->coords[i].min_y),
|
||||
_mesa_half_to_float(box16->coords[i].max_z) - _mesa_half_to_float(box16->coords[i].min_z),
|
||||
};
|
||||
float surface_area = 2 * (extent[0] * extent[1] + extent[0] * extent[2] + extent[1] * extent[2]);
|
||||
radv_gather_bvh_stats_gfx10_3(bvh, box16->children[i], depth + 1, surface_area, blas_sah, stats);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue