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/BuddhaCompute.glsl | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'BuddhaTest/Shaders/BuddhaCompute.glsl') diff --git a/BuddhaTest/Shaders/BuddhaCompute.glsl b/BuddhaTest/Shaders/BuddhaCompute.glsl index 9d8301a..ddcbace 100644 --- a/BuddhaTest/Shaders/BuddhaCompute.glsl +++ b/BuddhaTest/Shaders/BuddhaCompute.glsl @@ -2,9 +2,17 @@ //#version 430 //layout (local_size_x = 1024) in; //to be safe, we limit our local work group size to 1024. That's the minimum a GL 4.3 capable driver must support. -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; @@ -15,10 +23,10 @@ uniform uvec3 orbitLength; void addToColorOfCell(uvec2 cell, uvec3 toAdd) { - 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); + 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); } uvec2 getCell(vec2 complex) -- cgit v1.2.3