| 24 | |
| 25 | template<class Tutorial> |
| 26 | static void renderBenchFunc(BenchState& state, BenchParams& params ,int argc, char** argv) |
| 27 | { |
| 28 | #ifdef USE_GOOGLE_BENCHMARK |
| 29 | if (params.legacy) { |
| 30 | renderBenchmarkLegacy<Tutorial>(state, params, argc, argv); |
| 31 | return; |
| 32 | } |
| 33 | |
| 34 | Tutorial tutorial; |
| 35 | tutorial.interactive = false; |
| 36 | tutorial.main(argc,argv); |
| 37 | |
| 38 | tutorial.resize(tutorial.width, tutorial.height); |
| 39 | ISPCCamera ispccamera = tutorial.camera.getISPCCamera(tutorial.width, tutorial.height); |
| 40 | |
| 41 | for (size_t i = 0; i < params.skipIterations; i++) |
| 42 | { |
| 43 | tutorial.initRayStats(); |
| 44 | tutorial.render(tutorial.pixels,tutorial.width,tutorial.height,0.0f,ispccamera); |
| 45 | } |
| 46 | |
| 47 | size_t numRays = 0; |
| 48 | for (auto _ : *state.state) |
| 49 | { |
| 50 | tutorial.initRayStats(); |
| 51 | tutorial.render(tutorial.pixels,tutorial.width,tutorial.height,0.0f,ispccamera); |
| 52 | numRays += tutorial.getNumRays(); |
| 53 | } |
| 54 | |
| 55 | state.state->SetItemsProcessed(state.state->iterations()); |
| 56 | state.state->counters["Rays/s"] = benchmark::Counter(numRays, benchmark::Counter::kIsRate); |
| 57 | #else |
| 58 | renderBenchmarkLegacy<Tutorial>(state, params, argc, argv); |
| 59 | #endif |
| 60 | } |
| 61 | |
| 62 | template<class Tutorial> |
| 63 | static void renderBenchmarkLegacy(BenchState& state, BenchParams& params ,int argc, char** argv) |
nothing calls this directly
no test coverage detected