diff options
Diffstat (limited to 'BuddhaTest/Shaders')
-rw-r--r-- | BuddhaTest/Shaders/BuddhaCompute.glsl | 18 | ||||
-rw-r--r-- | BuddhaTest/Shaders/BuddhaFragment.glsl | 14 |
2 files changed, 8 insertions, 24 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) 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(){ |