Record build profile and temporal raster cost in lighting benchmark

This commit is contained in:
Emil
2026-09-24 02:53:01 +03:00
parent ac50ac8855
commit a428a33cb0
3 changed files with 19 additions and 12 deletions
+16 -11
View File
@@ -62,8 +62,8 @@ Options parse(int argc, char** argv) {
else if (name == "--run-index") options.run_index = number(value, name);
else if (name == "--commit") options.commit = value;
else if (name == "--driver") options.driver = value;
else if (name == "--csv") options.csv = value;
else if (name == "--capture") options.capture = value;
else if (name == "--csv") options.csv = faset::path_from_utf8(value);
else if (name == "--capture") options.capture = faset::path_from_utf8(value);
else if (name == "--shadows") {
if (value != "on" && value != "off")
throw std::invalid_argument("--shadows must be on or off");
@@ -165,14 +165,16 @@ void benchmark(const Options& options) {
for (unsigned i = 0; i < options.warmup; ++i)
renderer.render(scene);
if (!options.csv.parent_path().empty())
fs::create_directories(options.csv.parent_path());
std::ofstream csv(options.csv);
fs::create_directories(faset::native_io_path(options.csv.parent_path()));
std::ofstream csv(faset::native_io_path(options.csv));
if (!csv)
throw std::runtime_error("Cannot open benchmark CSV: " + options.csv.string());
csv << "light_count,shadows,visibility,effective_visibility,lighting_path,run_index,frame,"
throw std::runtime_error("Cannot open benchmark CSV: " + faset::path_to_utf8(options.csv));
csv << "light_count,shadows,visibility,effective_visibility,lighting_path,"
"build_configuration,run_index,frame,"
"device,driver,commit,width,height,validation_enabled,validation_errors,"
"submitted_local_lights,omitted_local_lights,shadow_tiles,draw_calls,gpu_bytes,"
"gpu_main_raster_ms,gpu_shadow_ms,gpu_ms,cpu_ms,readback_cpu_ms\n";
"gpu_main_raster_ms,gpu_post_raster_ms,gpu_post_visible,visibility_counters_valid,"
"gpu_shadow_ms,gpu_ms,cpu_ms,readback_cpu_ms\n";
csv << std::fixed << std::setprecision(6);
for (unsigned frame = 0; frame < options.frames; ++frame) {
renderer.render(scene);
@@ -187,7 +189,8 @@ void benchmark(const Options& options) {
throw std::runtime_error("GPU raster or frame timestamp was unavailable");
csv << options.lights << ',' << (options.shadows ? "on" : "off") << ','
<< mode_name(options.visibility) << ',' << mode_name(stats.effective_visibility_mode)
<< ",forward," << options.run_index << ',' << frame << ',';
<< ",forward," << FASET_BENCHMARK_CONFIGURATION << ','
<< options.run_index << ',' << frame << ',';
csv_text(csv, stats.device);
csv << ',';
csv_text(csv, options.driver);
@@ -197,13 +200,15 @@ void benchmark(const Options& options) {
<< (stats.validation_enabled ? 1 : 0) << ',' << stats.validation_errors << ','
<< stats.submitted_local_lights << ',' << stats.omitted_local_lights
<< ",0," << stats.draw_calls << ',' << stats.gpu_allocated_bytes << ','
<< stats.gpu_main_raster_ms << ",0," << stats.gpu_ms << ','
<< stats.gpu_main_raster_ms << ',' << stats.gpu_post_raster_ms << ','
<< stats.gpu_post_visible << ',' << (stats.visibility_counters_valid ? 1 : 0)
<< ",0," << stats.gpu_ms << ','
<< stats.cpu_ms << ',' << stats.readback_cpu_ms << '\n';
}
if (!csv)
throw std::runtime_error("Cannot finish benchmark CSV: " + options.csv.string());
throw std::runtime_error("Cannot finish benchmark CSV: " + faset::path_to_utf8(options.csv));
if (!options.capture.empty())
renderer.capture(options.capture);
renderer.capture(faset::native_io_path(options.capture));
}
} // namespace