Space Sim
Toggle main menu visibility
Loading...
Searching...
No Matches
src
particles
radix_scatter.comp
Go to the documentation of this file.
1
#version 440
7
#define WORKGROUP_SIZE 128
8
#define RADIX_SORT_BINS 128
9
#define SUBGROUP_SIZE 32
10
#define ITERATIONS 8
11
12
#define BODY_COUNT 15000
13
#define MAX_NODES 45000
14
uniform
int
iteration
;
15
layout
(local_size_x =
WORKGROUP_SIZE
) in;
16
17
struct
MortonEntry
18
{
19
uint
pid
;
20
uint
morton
;
21
};
22
layout
(std430, binding=2) buffer
MortonData
{
23
24
MortonEntry
entry[];
25
};
26
layout
(std430, binding=3) buffer MortonPingData {
27
28
MortonEntry
exit[];
29
};
30
layout
(std430, binding=7) buffer
RadixData
{
31
32
33
uint local_prefix[5000 *
WORKGROUP_SIZE
];
34
uint local_offsets[
BODY_COUNT
];
35
uint block_bin_count[5000 *
RADIX_SORT_BINS
];
36
uint global_offsets[5000 *
RADIX_SORT_BINS
];
37
uint local_bin_count[5000*
RADIX_SORT_BINS
];
38
39
};
40
void
main
()
41
{
42
43
uint tid = gl_GlobalInvocationID.x;
44
45
if
(tid >=
BODY_COUNT
)
return
;
46
MortonEntry
e;
47
uint shift = uint(
iteration
* 4);
48
if
(
iteration
% 2 == 0) {
49
e = entry[tid];
50
}
else
{
51
e = exit[tid];
52
}
53
54
uint bin = uint(e.
morton
>> shift) & uint(
RADIX_SORT_BINS
-1);
55
56
uint final_offset = global_offsets[gl_WorkGroupID.x *
RADIX_SORT_BINS
+ bin] + local_offsets[tid];
57
58
if
(
iteration
% 2 == 0) {
59
exit[final_offset] = e;
60
}
else
61
{
62
entry[final_offset] = e;
63
}
64
}
layout
layout(local_size_x=16, local_size_y=16, local_size_z=1) in
RADIX_SORT_BINS
#define RADIX_SORT_BINS
Definition
com22.comp:9
main
int main(int argc, char *argv[])
Definition
main.c:1726
MortonEntry::morton
uint morton
Definition
bounds.comp:32
MortonEntry::pid
uint pid
Definition
bounds.comp:31
MortonEntry
Definition
bounds.comp:30
morton
uint morton(uint x, uint y, uint z)
Definition
morton.comp:68
iteration
uniform int iteration
Definition
radix_new.comp:14
WORKGROUP_SIZE
#define WORKGROUP_SIZE
Definition
types.h:171
BODY_COUNT
#define BODY_COUNT
Definition
types.h:39
MortonData
Definition
types.h:140
RadixData
Definition
types.h:175
Generated by
1.18.0