From 385dd0dcf8fd003db604355341b00baa1fe1c1a0 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Sun, 18 Mar 2018 16:24:50 +0100 Subject: Add option to skip short orbits. Add option to print debug output. --- BuddhaTest/src/BuddhaTest.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'BuddhaTest/src/BuddhaTest.cpp') diff --git a/BuddhaTest/src/BuddhaTest.cpp b/BuddhaTest/src/BuddhaTest.cpp index 63720ed..1a960cb 100644 --- a/BuddhaTest/src/BuddhaTest.cpp +++ b/BuddhaTest/src/BuddhaTest.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include void error_callback(int error, const char* description) @@ -150,7 +151,7 @@ int main(int argc, char * argv[]) GLint widthUniformComputeHandle = glGetUniformLocation(ComputeShader, "width"); GLint heightUniformComputeHandle = glGetUniformLocation(ComputeShader, "height"); GLint iterationsPerDispatchHandle = glGetUniformLocation(ComputeShader, "iterationsPerDispatch"); - glUniform3ui(orbitLengthUniformHandle,settings.orbitLengthRed,settings.orbitLengthGreen,settings.orbitLengthBlue); + glUniform4ui(orbitLengthUniformHandle,settings.orbitLengthRed,settings.orbitLengthGreen,settings.orbitLengthBlue,settings.orbitLengthSkip); glUniform1ui(widthUniformComputeHandle, settings.imageWidth); glUniform1ui(heightUniformComputeHandle, bufferHeight); @@ -166,10 +167,15 @@ int main(int argc, char * argv[]) Helpers::PIDController pid{0.0f,0.0f,1e-4f}; const uint32_t targetFrameDuration{1000000/settings.targetFrameRate}; + 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)) { auto frameStart{std::chrono::high_resolution_clock::now()}; + totalIterationCount += iterationsPerFrame; //let the compute shader do something glUseProgram(ComputeShader); glUniform1ui(iterationsPerDispatchHandle, iterationsPerFrame); @@ -212,6 +218,14 @@ int main(int argc, char * argv[]) //std::cout << iterationsPerFrame << " " << pidOutput << std::endl; } + if(settings.printDebugOutput != 0 && totalIterationCount/maxOrbitlength > lastMessage) + { + lastMessage = totalIterationCount/maxOrbitlength; + const auto ctime = std::chrono::high_resolution_clock::to_time_t(frameStop); + std::cout << "Iteration count next frame: " << iterationsPerFrame << std::endl; + std::cout << std::put_time(std::localtime(&ctime),"%X") << ": Iteration count per worker higher than: " << lastMessage*maxOrbitlength << std::endl; + std::cout << std::put_time(std::localtime(&ctime),"%X") << ": Total iteration count higher than: " << lastMessage*maxOrbitlength*workersPerFrame << std::endl; + } } if(!settings.pngFilename.empty()) -- cgit v1.2.3