aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2018-03-22 21:40:31 +0100
committerAndreas Grois <andi@grois.info>2018-03-22 21:40:31 +0100
commitd06a01040cd7614a6951d6e6e350135a05ddb9c2 (patch)
treedccd810775b16eb7daf1b8c4f1ef43820c0446f6
parent99d34635228c81d1e8596bd74be047870dda6d9a (diff)
Divide et impera *is* faster. Finally.
-rw-r--r--BuddhaTest/Shaders/BuddhaCompute.glsl12
1 files changed, 9 insertions, 3 deletions
diff --git a/BuddhaTest/Shaders/BuddhaCompute.glsl b/BuddhaTest/Shaders/BuddhaCompute.glsl
index 93f5704..0ce19f7 100644
--- a/BuddhaTest/Shaders/BuddhaCompute.glsl
+++ b/BuddhaTest/Shaders/BuddhaCompute.glsl
@@ -49,9 +49,15 @@ void uintMaxIP(inout uvec3 modified, const uvec3 constant)
void addToColorOfCell(uvec2 cell, uvec3 toAdd)
{
uint firstIndex = 3*(cell.x + cell.y * width);
- uintMaxIP(brightnesses[gl_LocalInvocationIndex].x, atomicAdd(counts_SSBO[firstIndex],toAdd.x));
- uintMaxIP(brightnesses[gl_LocalInvocationIndex].y, atomicAdd(counts_SSBO[firstIndex+1],toAdd.y));
- uintMaxIP(brightnesses[gl_LocalInvocationIndex].z, atomicAdd(counts_SSBO[firstIndex+2],toAdd.z));
+ uvec3 b;
+ b.x = atomicAdd(counts_SSBO[firstIndex],toAdd.x);
+ b.y = atomicAdd(counts_SSBO[firstIndex+1],toAdd.y);
+ b.z = atomicAdd(counts_SSBO[firstIndex+2],toAdd.z);
+ for(int i = 0; i < 3;++i)
+ {
+ if(brightnesses[gl_LocalInvocationIndex][i] < b[i])
+ brightnesses[gl_LocalInvocationIndex][i] = b[i];
+ }
}
uvec2 getCell(vec2 complex)