diff options
Diffstat (limited to 'BuddhaTest/src')
-rw-r--r-- | BuddhaTest/src/BuddhaTest.cpp | 16 | ||||
-rw-r--r-- | BuddhaTest/src/Helpers.cpp | 6 |
2 files changed, 20 insertions, 2 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()) diff --git a/BuddhaTest/src/Helpers.cpp b/BuddhaTest/src/Helpers.cpp index 5385866..e499f0c 100644 --- a/BuddhaTest/src/Helpers.cpp +++ b/BuddhaTest/src/Helpers.cpp @@ -323,6 +323,7 @@ namespace Helpers {"--imageHeight",&imageHeight}, {"--windowWidth",&windowWidth}, {"--windowHeight",&windowHeight}, + {"--orbitLengthSkip",&orbitLengthSkip}, {"--orbitLengthRed",&orbitLengthRed}, {"--orbitLengthGreen",&orbitLengthGreen}, {"--orbitLengthBlue",&orbitLengthBlue}, @@ -336,7 +337,8 @@ namespace Helpers {"--imageGamma",&pngGamma}, {"--imageColorScale",&pngColorScale}, {"--output", &pngFilename}, - {"--ignoreMaxBufferSize", &ignoreMaxBufferSize} + {"--ignoreMaxBufferSize", &ignoreMaxBufferSize}, + {"--printDebugOutput", &printDebugOutput} }; for(int i=1; i < argc;++i) @@ -353,6 +355,7 @@ namespace Helpers "--imageColorScale [float] : Image brightness is scaled by the brightest pixel. The result is multiplied by this value. 2.0 by default, as 1.0 leaves very little dynamic range." << std::endl << "--windowWidth [integer] : Width of the preview window. 1024 by default." << std::endl << "--windowHeight [integer] : Height of the preview window. 576 by default." << std::endl << + "--orbitLengthSkip [integer] : Minimum lengths for escaping orbits to be drawn at all. Default 0." << std::endl << "--orbitLengthRed [integer] : Maximum number of iterations for escaping orbits to color red. 10 by default." << std::endl << "--orbitLengthGreen [integer] : Maximum number of iterations for escaping orbits to color green. 100 by default." << std::endl << "--orbitLengthBlue [integer] : Maximum number of iterations for escaping orbits to color blue. 1000 by default." << std::endl << @@ -364,6 +367,7 @@ namespace Helpers "--globalWorkgroupSizeY [integer] : How often the local work group should be invoked per frame. Values up to 65535 are guaranteed to work. Default is 64." << std::endl << "--globalWorkgroupSizeZ [integer] : How often the local work group should be invoked per frame. Values up to 65535 are guaranteed to work. Default is 1." << std::endl << "--targetFrameRate [integer] : The number of iterations per frame will dynamically adjust to approximately reach this framerate. Default: 60." << std::endl << + "--printDebugOutput [0,1] : If set to 1, every orbitLength a message will be printed to stdout. Default 0." << std::endl << "--ignoreMaxBufferSize [0,1] : If set to 1, a failed maximum buffer size check is not treated as error. Some graphics drivers report lower values than their absolute limit. Do this on your own risk, though." << std::endl; return false; } |