aboutsummaryrefslogtreecommitdiff
path: root/BuddhaTest/Shaders/BuddhaFragment.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/BuddhaFragment.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/BuddhaFragment.glsl')
-rw-r--r--BuddhaTest/Shaders/BuddhaFragment.glsl14
1 files changed, 3 insertions, 11 deletions
diff --git a/BuddhaTest/Shaders/BuddhaFragment.glsl b/BuddhaTest/Shaders/BuddhaFragment.glsl
index b33ee1d..449aa29 100644
--- a/BuddhaTest/Shaders/BuddhaFragment.glsl
+++ b/BuddhaTest/Shaders/BuddhaFragment.glsl
@@ -6,15 +6,7 @@ out vec3 color;
layout(std430, binding=2) restrict readonly buffer renderedDataRed
{
- restrict readonly uint counts_SSBORed[];
-};
-layout(std430, binding=3) restrict readonly buffer renderedDataGreen
-{
- restrict readonly uint counts_SSBOGreen[];
-};
-layout(std430, binding=4) restrict readonly buffer renderedDataBlue
-{
- restrict readonly uint counts_SSBOBlue[];
+ restrict readonly uint counts_SSBO[];
};
uniform uint width;
@@ -24,8 +16,8 @@ uvec3 getColorAt(vec2 fragCoord)
{
uint xIndex = uint(max(0.0,(fragCoord.x+1.0)*0.5*width));
uint yIndex = uint(max(0.0,abs(fragCoord.y)*height));
- uint firstIndex = (xIndex + yIndex * width);
- return uvec3(counts_SSBORed[firstIndex],counts_SSBOGreen[firstIndex],counts_SSBOBlue[firstIndex]);
+ uint firstIndex = 3*(xIndex + yIndex * width);
+ return uvec3(counts_SSBO[firstIndex],counts_SSBO[firstIndex+1],counts_SSBO[firstIndex+2]);
}
void main(){