Created
November 27, 2016 03:43
-
-
Save dboyan/915047bedc30cf9b498557aa320b3987 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 | |
layout(local_size_x = 64) in; | |
layout(binding = 0, std430) writeonly buffer resBlock { | |
vec3 res1; | |
vec3 res2; | |
}; | |
shared uvec3 a; | |
shared uint bx, by, bz; | |
void main() | |
{ | |
if (gl_LocalInvocationID.x == 0u) { | |
a = uvec3(0u); | |
bx = 0u; | |
by = 0u; | |
bz = 0u; | |
} | |
barrier(); | |
uvec3 t = uvec3(1u); | |
atomicAdd(a.x, t.x); | |
atomicAdd(a.y, t.y); | |
atomicAdd(a.z, t.z); | |
atomicAdd(bx, t.x); | |
atomicAdd(by, t.y); | |
atomicAdd(bz, t.z); | |
barrier(); | |
if (gl_LocalInvocationID.x == 0u) { | |
res1 = a; | |
res2 = uvec3(bx, by, bz); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment