| 43 | } |
| 44 | |
| 45 | static void BatchRendering(RenderConfig *config, RenderState *startState, Film *startFilm) { |
| 46 | RenderSession *session = RenderSession::Create(config, startState, startFilm); |
| 47 | |
| 48 | const unsigned int haltTime = config->GetProperty("batch.halttime").Get<unsigned int>(); |
| 49 | const unsigned int haltSpp = config->GetProperty("batch.haltspp").Get<unsigned int>(); |
| 50 | |
| 51 | // Start the rendering |
| 52 | session->Start(); |
| 53 | |
| 54 | const Properties &stats = session->GetStats(); |
| 55 | while (!session->HasDone()) { |
| 56 | boost::this_thread::sleep(boost::posix_time::millisec(1000)); |
| 57 | session->UpdateStats(); |
| 58 | |
| 59 | const double elapsedTime = stats.Get("stats.renderengine.time").Get<double>(); |
| 60 | const unsigned int pass = stats.Get("stats.renderengine.pass").Get<unsigned int>(); |
| 61 | // Convergence test is update inside UpdateFilm() |
| 62 | const float convergence = stats.Get("stats.renderengine.convergence").Get<float>(); |
| 63 | |
| 64 | // Print some information about the rendering progress |
| 65 | LC_LOG(boost::str(boost::format("[Elapsed time: %3d/%dsec][Samples %4d/%d][Convergence %f%%][Avg. samples/sec % 3.2fM on %.1fK tris]") % |
| 66 | int(elapsedTime) % int(haltTime) % pass % haltSpp % (100.f * convergence) % |
| 67 | (stats.Get("stats.renderengine.total.samplesec").Get<double>() / 1000000.0) % |
| 68 | (stats.Get("stats.dataset.trianglecount").Get<double>() / 1000.0))); |
| 69 | } |
| 70 | |
| 71 | // Stop the rendering |
| 72 | session->Stop(); |
| 73 | |
| 74 | const string renderEngine = config->GetProperty("renderengine.type").Get<string>(); |
| 75 | if (renderEngine != "FILESAVER") { |
| 76 | // Save the rendered image |
| 77 | session->GetFilm().SaveOutputs(); |
| 78 | } |
| 79 | |
| 80 | delete session; |
| 81 | } |
| 82 | |
| 83 | int main(int argc, char *argv[]) { |
| 84 | // This is required to run AMD GPU profiler |
no test coverage detected