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/src/BuddhaTest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'BuddhaTest/src/BuddhaTest.cpp') diff --git a/BuddhaTest/src/BuddhaTest.cpp b/BuddhaTest/src/BuddhaTest.cpp index 3b99169..0a99fee 100644 --- a/BuddhaTest/src/BuddhaTest.cpp +++ b/BuddhaTest/src/BuddhaTest.cpp @@ -148,6 +148,7 @@ int main(int argc, char * argv[]) glUseProgram(ComputeShader); GLint orbitLengthUniformHandle = glGetUniformLocation(ComputeShader, "orbitLength"); + GLint totalIterationsUniformHandle = glGetUniformLocation(ComputeShader, "totalIterations"); GLint widthUniformComputeHandle = glGetUniformLocation(ComputeShader, "width"); GLint heightUniformComputeHandle = glGetUniformLocation(ComputeShader, "height"); GLint iterationsPerDispatchHandle = glGetUniformLocation(ComputeShader, "iterationsPerDispatch"); @@ -155,6 +156,9 @@ int main(int argc, char * argv[]) glUniform1ui(widthUniformComputeHandle, settings.imageWidth); glUniform1ui(heightUniformComputeHandle, bufferHeight); + const uint32_t maxOrbitlength = std::max(std::max(settings.orbitLengthBlue,settings.orbitLengthGreen),settings.orbitLengthRed); + glUniform1ui(totalIterationsUniformHandle, maxOrbitlength); + glUseProgram(VertexAndFragmentShaders); GLint widthUniformFragmentHandle = glGetUniformLocation(VertexAndFragmentShaders, "width"); GLint heightUniformFragmentHandle = glGetUniformLocation(VertexAndFragmentShaders, "height"); @@ -169,7 +173,6 @@ int main(int argc, char * argv[]) uint64_t totalIterationCount{0}; uint64_t lastMessage{0}; - const uint64_t maxOrbitlength = std::max(std::max(settings.orbitLengthBlue,settings.orbitLengthGreen),settings.orbitLengthRed); /* Loop until the user closes the window */ while (!glfwWindowShouldClose(window)) -- cgit v1.2.3