diff options
author | Andreas Grois <andi@grois.info> | 2018-03-18 16:24:50 +0100 |
---|---|---|
committer | Andreas Grois <andi@grois.info> | 2018-03-18 16:24:50 +0100 |
commit | 385dd0dcf8fd003db604355341b00baa1fe1c1a0 (patch) | |
tree | 865d70f26341a019df54cf7492a5fb943eac3325 /BuddhaTest/src/BuddhaTest.cpp | |
parent | f3f67518d7eb74c868b523851ec482cd2177c3ce (diff) |
Add option to skip short orbits. Add option to print debug output.
Diffstat (limited to 'BuddhaTest/src/BuddhaTest.cpp')
-rw-r--r-- | BuddhaTest/src/BuddhaTest.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
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 <iostream> #include <vector> #include <chrono> +#include <iomanip> #include <algorithm> 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<float, std::chrono::high_resolution_clock::time_point::rep> 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()) |