From db2ea861c688aadf59fc35ff6cfca69149a1a94c Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Sun, 18 Mar 2018 20:45:26 +0100 Subject: Move totaliterations calculation to CPU. This frees 4 VGPRs. Now the code is back to the limit of 32 VGPRs without the need to directly operate on the state buffer. This means that now it's bound by memory access. --- BuddhaTest/Shaders/BuddhaCompute.glsl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'BuddhaTest/Shaders') diff --git a/BuddhaTest/Shaders/BuddhaCompute.glsl b/BuddhaTest/Shaders/BuddhaCompute.glsl index 10dfe23..7cd4efe 100644 --- a/BuddhaTest/Shaders/BuddhaCompute.glsl +++ b/BuddhaTest/Shaders/BuddhaCompute.glsl @@ -34,6 +34,7 @@ uniform uint height; uniform uvec4 orbitLength; uniform uint iterationsPerDispatch; +uniform uint totalIterations; void addToColorOfCell(uvec2 cell, uvec3 toAdd) { @@ -202,15 +203,11 @@ vec2 getCurrentOrbitOffset(const uint orbitNumber, const uint totalWorkers, cons void main() { //we need to know how many total work groups are running this iteration - const uvec3 totalWorkersPerDimension = gl_WorkGroupSize * gl_NumWorkGroups; const uint totalWorkers = totalWorkersPerDimension.x*totalWorkersPerDimension.y*totalWorkersPerDimension.z; const uint uniqueWorkerID = gl_GlobalInvocationID.x + gl_GlobalInvocationID.y*totalWorkersPerDimension.x + gl_GlobalInvocationID.z*(totalWorkersPerDimension.x * totalWorkersPerDimension.y); - const uint _totalIterations = orbitLength.x > orbitLength.y ? orbitLength.x : orbitLength.y; - const uint totalIterations = _totalIterations > orbitLength.z ? _totalIterations : orbitLength.z; - individualData state = stateArray[uniqueWorkerID]; //getIndividualState(in uint CellID, out vec2 offset, out vec2 coordinates, out uint phase, out uint orbitNumber, out uint doneIterations) -- cgit v1.2.3