gKit2 light
Toggle main menu visibility
Loading...
Searching...
No Matches
gkit2_tutos
min_atomic.glsl
Go to the documentation of this file.
1
3
4
#version 430
5
6
#ifdef COMPUTE_SHADER
7
8
layout(binding= 0, std430) readonly buffer inputData
9
{
10
int
data[];
11
};
12
13
layout(binding= 1, std430) coherent buffer tmpData
14
{
15
int
tmp[];
16
};
17
18
uniform uint N;
19
20
#if 1
21
shared
int
min_group;
22
23
layout(local_size_x= 1024) in;
24
void
main( )
25
{
26
uint
id
= gl_GlobalInvocationID.x;
27
28
if
(gl_LocalInvocationID.x == 0)
29
min_group= 1000000;
// max int
30
31
barrier();
32
memoryBarrierShared();
33
34
if
(
id
< N)
35
atomicMin(min_group, data[
id
]);
36
37
if
(gl_LocalInvocationID.x == 0)
38
atomicMin(tmp[1], min_group);
39
}
40
#else
41
layout(local_size_x= 1024) in;
42
void
main( )
43
{
44
uint
id
= gl_GlobalInvocationID.x;
45
46
if
(
id
< N)
47
atomicMin(tmp[1], data[
id
]);
48
}
49
#endif
50
51
#endif
52
Generated on
for gKit2 light by
1.17.0