forked from jbikker/tinybvh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtraverse.cl
35 lines (30 loc) · 924 Bytes
/
traverse.cl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// gpu-side code for ray traversal
struct Ray
{
// data is defined here as 16-byte values to encourage the compilers
// to fetch 16 bytes at a time: 12 (so, 8 + 4) will be slower.
float4 O, D, rD; // 48 byte
float4 hit; // 16 byte
};
// #define CWBVH_COMPRESSED_TRIS // sync with tiny_bvh.h
// #define BVH4_GPU_COMPRESSED_TRIS // sync with tiny_bvh.h
// BVH traversal stack size
#define STACK_SIZE 32
// Low-level optimizations for specific platforms
#ifdef ISINTEL // Iris Xe, Arc, ..
// #define USE_VLOAD_VSTORE
#define SIMD_AABBTEST
#elif defined ISNVIDIA // 2080, 3080, 4080, ..
#define USE_VLOAD_VSTORE
// #define SIMD_AABBTEST
#elif defined ISAMD
#define USE_VLOAD_VSTORE
// #define SIMD_AABBTEST
#else // unkown GPU
// #define USE_VLOAD_VSTORE
#define SIMD_AABBTEST
#endif
// Includes for traversal kernel implementations:
#include "traverse_bvh2.cl"
#include "traverse_bvh4.cl"
#include "traverse_cwbvh.cl"