This commit is contained in:
2026-08-12 11:03:16 +08:00
parent 0910b73ea4
commit 898a58b554
18 changed files with 521 additions and 277 deletions
@@ -4,8 +4,10 @@
#include <gtest/gtest.h>
#include <algorithm>
#include <array>
#include <chrono>
#include <cstddef>
#include <memory_resource>
#include <thread>
#include <vector>
namespace renderive {
namespace {
@@ -668,12 +670,18 @@ TEST(Renderive_Core2, PartitionedPlotsBuildPropertyDrivenTaskGraphs) {
.set_pixel_length(180)
.build();
const auto spectrum = Spectrum::Builder{}
.set<&Spectrum::Properties::partition_mode>(
Render_Partition_Mode::Fixed)
.set<&Spectrum::Properties::partition_count>(4)
.build(root, frequency, power);
const auto waterfall = Waterfall::Builder{}
.set<&Waterfall::Properties::partition_mode>(
Render_Partition_Mode::Fixed)
.set<&Waterfall::Properties::partition_count>(4)
.build(root, frequency, time);
const auto afterglow = Afterglow::Builder{}
.set<&Afterglow::Properties::partition_mode>(
Render_Partition_Mode::Fixed)
.set<&Afterglow::Properties::partition_count>(4)
.build(root, frequency, power);
@@ -692,14 +700,37 @@ TEST(Renderive_Core2, PartitionedPlotsBuildPropertyDrivenTaskGraphs) {
EXPECT_EQ(waterfall->task_graph()->nodes().size(), 3u);
EXPECT_EQ(afterglow->task_graph()->nodes().size(), 5u);
spectrum->set<&Spectrum::Properties::partition_count>(0);
waterfall->set<&Waterfall::Properties::partition_count>(0);
afterglow->set<&Afterglow::Properties::partition_count>(0);
spectrum->set<&Spectrum::Properties::partition_mode>(Render_Partition_Mode::Automatic);
waterfall->set<&Waterfall::Properties::partition_mode>(Render_Partition_Mode::Automatic);
afterglow->set<&Afterglow::Properties::partition_mode>(Render_Partition_Mode::Automatic);
spectrum->scene().publish_frame_state();
const auto workers = Scene_Base::task_executor_worker_count();
EXPECT_EQ(spectrum->task_graph()->nodes().size(), workers + 2u);
EXPECT_EQ(waterfall->task_graph()->nodes().size(), workers + 2u);
EXPECT_EQ(afterglow->task_graph()->nodes().size(), workers * 2u + 3u);
EXPECT_EQ(spectrum->task_graph()->nodes().size(), 3u);
EXPECT_EQ(waterfall->task_graph()->nodes().size(), 3u);
EXPECT_EQ(afterglow->task_graph()->nodes().size(), 5u);
}
TEST(Renderive_Core2, AutomaticPartitioningSplitsOnlyForMeasuredBottlenecks) {
detail::Adaptive_Render_Partitioner partitioner;
EXPECT_EQ(partitioner.graph_partition_count(
Render_Partition_Mode::Automatic, 8, 8, 4096, 128),
1);
EXPECT_EQ(partitioner.begin(1, 4096), 1);
std::this_thread::sleep_for(std::chrono::milliseconds(2));
EXPECT_TRUE(partitioner.finish(Render_Partition_Mode::Automatic, 1, 0,
8, 4096, 128));
EXPECT_EQ(partitioner.graph_partition_count(
Render_Partition_Mode::Automatic, 8, 8, 4096, 128),
2);
EXPECT_EQ(partitioner.begin(2, 4096), 2);
EXPECT_TRUE(partitioner.finish(Render_Partition_Mode::Automatic, 2, 0,
8, 4096, 128));
EXPECT_EQ(partitioner.graph_partition_count(
Render_Partition_Mode::Automatic, 8, 8, 4096, 128),
1);
EXPECT_EQ(partitioner.graph_partition_count(
Render_Partition_Mode::Fixed, 7, 2, 1, 4096),
7);
}
TEST(Renderive_Core2, PlottableAxesAreDataDependenciesAndPaintOverlays) {
Plot_Core plot;