File tree Expand file tree Collapse file tree 2 files changed +141
-2
lines changed
RadeonRays/src/kernels/GLSL Expand file tree Collapse file tree 2 files changed +141
-2
lines changed Original file line number Diff line number Diff line change 24
24
// THE SOFTWARE.
25
25
//
26
26
27
- layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
27
+ #define INVALID_ADDR 0xffffffffu
28
+ #define INTERNAL_NODE(node) ((node).addr_left != INVALID_ADDR)
29
+
30
+ #define GROUP_SIZE 64
31
+ #define STACK_SIZE 32
32
+ #define LDS_STACK_SIZE 8
33
+
34
+ struct BvhNode
35
+ {
36
+ vec3 aabb_left_min_or_v0;
37
+ uint addr_left;
38
+ vec3 aabb_left_max_or_v1;
39
+ uint mesh_id;
40
+ vec3 aabb_right_min_or_v2;
41
+ uint addr_right;
42
+ vec3 aabb_right_max;
43
+ uint prim_id;
44
+ };
45
+
46
+ struct Intersection
47
+ {
48
+ int shape_id;
49
+ int prim_id;
50
+ ivec2 padding;
51
+ vec4 uvwt;
52
+ };
53
+
54
+ struct ray
55
+ {
56
+ vec4 o;
57
+ vec4 d;
58
+ ivec2 extra;
59
+ ivec2 padding;
60
+ };
61
+
62
+ layout(std140, binding = 0) buffer restrict readonly NodesBlock
63
+ {
64
+ BvhNode Nodes[];
65
+ };
66
+
67
+ layout(std140, binding = 1) buffer restrict readonly RaysBlock
68
+ {
69
+ ray Rays[];
70
+ };
71
+
72
+ layout(std140, binding = 2) buffer restrict readonly NumraysBlock
73
+ {
74
+ int Numrays;
75
+ };
76
+
77
+ layout(std430, binding = 3) buffer StackBlock
78
+ {
79
+ int Stack[];
80
+ };
81
+
82
+ layout(std430, binding = 4) buffer restrict writeonly HitsBlock
83
+ {
84
+ Intersection Hits[];
85
+ };
86
+
87
+ layout(std430, binding = 4) buffer restrict writeonly HitsResults
88
+ {
89
+ int Hitresults[];
90
+ };
91
+
92
+ layout(local_size_x = GROUP_SIZE, local_size_y = 1, local_size_z = 1) in;
93
+
94
+ shared uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE];
95
+
96
+ // TODO: implement traversal kernels (gboisse)
Original file line number Diff line number Diff line change 1
1
#version 430
2
+ #extension GL_AMD_gpu_shader_half_float : require
2
3
3
4
// Note Anvil define system assumes first line is alway a #version so don't rearrange
4
5
24
25
// THE SOFTWARE.
25
26
//
26
27
27
- layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
28
+ #define INVALID_ADDR 0xffffffffu
29
+ #define INTERNAL_NODE(node) ((node).addr0 != INVALID_ADDR)
30
+
31
+ #define GROUP_SIZE 64
32
+ #define STACK_SIZE 32
33
+ #define LDS_STACK_SIZE 16
34
+
35
+ struct BvhNode
36
+ {
37
+ uvec3 aabb01_min_or_v0;
38
+ uint addr0;
39
+ uvec3 aabb01_max_or_v1;
40
+ uint addr1_or_mesh_id;
41
+ uvec3 aabb23_min_or_v2;
42
+ uint addr2_or_prim_id;
43
+ uvec3 aabb23_max;
44
+ uint addr3;
45
+ };
46
+
47
+ struct Intersection
48
+ {
49
+ int shape_id;
50
+ int prim_id;
51
+ ivec2 padding;
52
+ vec4 uvwt;
53
+ };
54
+
55
+ struct ray
56
+ {
57
+ vec4 o;
58
+ vec4 d;
59
+ ivec2 extra;
60
+ ivec2 padding;
61
+ };
62
+
63
+ layout(std140, binding = 0) buffer restrict readonly NodesBlock
64
+ {
65
+ BvhNode Nodes[];
66
+ };
67
+
68
+ layout(std140, binding = 1) buffer restrict readonly RaysBlock
69
+ {
70
+ ray Rays[];
71
+ };
72
+
73
+ layout(std140, binding = 2) buffer restrict readonly NumraysBlock
74
+ {
75
+ int Numrays;
76
+ };
77
+
78
+ layout(std430, binding = 3) buffer StackBlock
79
+ {
80
+ int Stack[];
81
+ };
82
+
83
+ layout(std430, binding = 4) buffer restrict writeonly HitsBlock
84
+ {
85
+ Intersection Hits[];
86
+ };
87
+
88
+ layout(std430, binding = 4) buffer restrict writeonly HitsResults
89
+ {
90
+ int Hitresults[];
91
+ };
92
+
93
+ layout(local_size_x = GROUP_SIZE, local_size_y = 1, local_size_z = 1) in;
94
+
95
+ shared uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE];
96
+
97
+ // TODO: implement traversal kernels (gboisse)
You can’t perform that action at this time.
0 commit comments