aboutsummaryrefslogtreecommitdiff
path: root/BuddhaTest/Shaders/BuddhaCompute.glsl
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2018-03-18 21:11:39 +0100
committerAndreas Grois <andi@grois.info>2018-03-18 21:11:39 +0100
commitdc193156a82a80cc8d2321cf065019035855516f (patch)
treed665ca5bd8b0b1aec7caf835814b2fe5d5b87347 /BuddhaTest/Shaders/BuddhaCompute.glsl
parentdb2ea861c688aadf59fc35ff6cfca69149a1a94c (diff)
Undo splitting of buffers in three. Makes buffer access much faster
Not kidding here. For the default parameters this increased the maximum pixel brightness in the image by a factor of 2.25. This has the drawback that the maximum possible image size got reduced, but hey, there's a command line switch to ignore all size limits ;-)
Diffstat (limited to 'BuddhaTest/Shaders/BuddhaCompute.glsl')
-rw-r--r--BuddhaTest/Shaders/BuddhaCompute.glsl18
1 files changed, 5 insertions, 13 deletions
diff --git a/BuddhaTest/Shaders/BuddhaCompute.glsl b/BuddhaTest/Shaders/BuddhaCompute.glsl
index 7cd4efe..caf10ee 100644
--- a/BuddhaTest/Shaders/BuddhaCompute.glsl
+++ b/BuddhaTest/Shaders/BuddhaCompute.glsl
@@ -4,15 +4,7 @@
layout(std430, binding=2) restrict buffer renderedDataRed
{
- restrict uint counts_SSBORed[];
-};
-layout(std430, binding=3) restrict buffer renderedDataGreen
-{
- restrict uint counts_SSBOGreen[];
-};
-layout(std430, binding=4) restrict buffer renderedDataBlue
-{
- restrict uint counts_SSBOBlue[];
+ restrict uint counts_SSBO[];
};
struct individualData
@@ -38,10 +30,10 @@ uniform uint totalIterations;
void addToColorOfCell(uvec2 cell, uvec3 toAdd)
{
- uint firstIndex = (cell.x + cell.y * width);
- atomicAdd(counts_SSBORed[firstIndex],toAdd.x);
- atomicAdd(counts_SSBOGreen[firstIndex],toAdd.y);
- atomicAdd(counts_SSBOBlue[firstIndex],toAdd.z);
+ uint firstIndex = 3*(cell.x + cell.y * width);
+ atomicAdd(counts_SSBO[firstIndex],toAdd.x);
+ atomicAdd(counts_SSBO[firstIndex+1],toAdd.y);
+ atomicAdd(counts_SSBO[firstIndex+2],toAdd.z);
}
uvec2 getCell(vec2 complex)