From 627aa610fc93398ac51129096ce8fb30731af341 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Sun, 11 Mar 2018 21:27:11 +0100 Subject: Split buffer in three, one per color (as OpenGL guarantees that one can at least have 8 SSBOs), to allow three times larger images. Also make it possible to ignore maximum buffer size reported by the driver. The maximum buffer size limitation is rather strict on radeonsi, so I decided to split the buffer in three, effectively increasing the maximum image size by a factor of three. While doing so I realized that at least on radeonsi the reported maximum buffer size seems to be off. For this reason I added a new command line switch, that allows to ignore the maximum buffer size check. For those curious: radeonsi reports a maximum buffer size of 128 MB, but I had no problems when using three buffers of 1098 MB each. --- BuddhaTest/Shaders/BuddhaFragment.glsl | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'BuddhaTest/Shaders/BuddhaFragment.glsl') diff --git a/BuddhaTest/Shaders/BuddhaFragment.glsl b/BuddhaTest/Shaders/BuddhaFragment.glsl index 1556065..24fb6a7 100644 --- a/BuddhaTest/Shaders/BuddhaFragment.glsl +++ b/BuddhaTest/Shaders/BuddhaFragment.glsl @@ -4,9 +4,17 @@ in vec2 uv; out vec3 color; -layout(std430, binding=2) buffer renderedData +layout(std430, binding=2) buffer renderedDataRed { - uint counts_SSBO[]; + uint counts_SSBORed[]; +}; +layout(std430, binding=3) buffer renderedDataGreen +{ + uint counts_SSBOGreen[]; +}; +layout(std430, binding=4) buffer renderedDataBlue +{ + uint counts_SSBOBlue[]; }; uniform uint width; @@ -16,8 +24,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 = 3*(xIndex + yIndex * width); - return uvec3(counts_SSBO[firstIndex],counts_SSBO[firstIndex+1],counts_SSBO[firstIndex+2]); + uint firstIndex = (xIndex + yIndex * width); + return uvec3(counts_SSBORed[firstIndex],counts_SSBOGreen[firstIndex],counts_SSBOBlue[firstIndex]); } void main(){ -- cgit v1.2.3