Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Floor tier: SF_HW_SIMULATE=floor, benchmark frame split, design targets and canvas track

islandmed4eff383ed665
diff --git a/src/app/App.cpp b/src/app/App.cpp
index 8176a49f..02d0cf54 100644
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@ -664,7 +664,7 @@ int App::run() {
double phase[10] = {};
int phases = 0;
const auto mark = [&] {
- if (frameLogMs >= 0.0 && phases < 10) phase[phases++] = double(SDL_GetTicksNS()) * 1e-6;
+ if ((frameLogMs >= 0.0 || proof_) && phases < 10) phase[phases++] = double(SDL_GetTicksNS()) * 1e-6;
};
auto seconds = [] { return double(SDL_GetTicksNS()) * 1e-9; };
// --measure-idle: let start-up settle (first frames, the LightBox's thumbnails), then count.
@@ -1012,7 +1012,9 @@ int App::run() {
if (proof_) proofBeforeSwap(fbW, fbH); // Help > Benchmark: timing, video capture, the scripted pointer
SDL_GL_SwapWindow(window_);
mark();
- if (phases == 7 && phase[6] - phase[0] > frameLogMs)
+ if (phases == 7) // (Help > Benchmark splits each phase's frames by these)
+ for (int k = 0; k < 6; ++k) frameSplitMs_[k] = phase[k + 1] - phase[k];
+ if (phases == 7 && frameLogMs >= 0.0 && phase[6] - phase[0] > frameLogMs)
SDL_Log("frame %.1f ms: events %.1f, dabs %.1f, UI %.1f, ghost + sync %.1f, draw %.1f, UI draw + swap %.1f",
phase[6] - phase[0], phase[1] - phase[0], phase[2] - phase[1], phase[3] - phase[2], phase[4] - phase[3],
phase[5] - phase[4], phase[6] - phase[5]);
diff --git a/src/app/App.h b/src/app/App.h
index a4a5ed30..9189afd5 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -2057,6 +2057,9 @@ private:
// stroke through the input handlers on 5M..100M+ meshes with a live HUD, an MP4 and a JSON result.
std::shared_ptr<struct TimelineUiState> timelineUi_;
std::shared_ptr<struct ProofState> proof_;
+ // The last drawn frame's time by part (run()'s marks): events, dabs, UI, ghost + scene sync (the upload), draw,
+ // UI draw + swap (where the frame waits for the GPU).
+ double frameSplitMs_[6] = {};
void drawTimelineUi(); // once a frame from drawUi: keeps the timeline attached and draws the strip
float timelineTopInset_ = 0.0f; // how far down the canvas the strip (or its tab) reaches at the top; 0 at the bottom
float timelineStripY_ = -1.0f; // the strip's (or tab's) top edge in window pixels this frame (-1: not shown)
diff --git a/src/app/Calibration.cpp b/src/app/Calibration.cpp
index 05ddd8c5..07bc42ea 100644
--- a/src/app/Calibration.cpp
+++ b/src/app/Calibration.cpp
@@ -570,6 +570,10 @@ HardwareProfile Calibrator::profile(const ProfileOverrides& overrides, const Pro
}
void applyCachedThreadCount() {
+ if (simulatedFloorTier()) { // (4 cores; the renderer leaves out GL 4.4 buffer storage: Renderer::persistentUpload)
+ ThreadPool::setSharedThreadCount(4);
+ return;
+ }
HardwareProfile cached;
if (loadHardwareProfile(hardwareProfilePath(), cached) && cached.settings.threads > 0)
ThreadPool::setSharedThreadCount(cached.settings.threads);
diff --git a/src/app/PanelPerformanceProfile.cpp b/src/app/PanelPerformanceProfile.cpp
index 386405ea..7d564894 100644
--- a/src/app/PanelPerformanceProfile.cpp
+++ b/src/app/PanelPerformanceProfile.cpp
@@ -164,12 +164,26 @@ void App::applyHardwareProfile(const HardwareProfile& p, bool announce) {
PerformanceSettings s = p.settings;
s.targetFps = hw.tier.targetHz;
s.uploadBudgetMBPerFrame = hw.tier.uploadBudgetMBPerFrame;
+ const bool floor = simulatedFloorTier();
+ if (floor) { // SF_HW_SIMULATE=floor: an integrated GPU's budgets (docs/design/perf-moonshots.md §0)
+ s.renderTriangleBudget = std::min<uint64_t>(s.renderTriangleBudget, 2'000'000);
+ s.motionProxyThreshold = std::min<uint64_t>(s.motionProxyThreshold, 3'000'000);
+ s.vramBudgetMB = std::min<uint64_t>(s.vramBudgetMB, 1536);
+ s.uploadBudgetMBPerFrame = std::min<uint64_t>(s.uploadBudgetMBPerFrame, 16);
+ s.threads = 4;
+ hw.tier.uploadBudgetMBPerFrame = s.uploadBudgetMBPerFrame;
+ hw.tier.residentCacheCapMB = std::min<uint64_t>(hw.tier.residentCacheCapMB, 1024);
+ hw.tier.zeroCopyUMA = false;
+ setCurrentTierConfig(hw.tier);
+ SDL_Log("Hardware profile: simulating the floor tier (SF_HW_SIMULATE=floor): budget 2M triangles, 4 threads");
+ }
hw.profile.settings.targetFps = s.targetFps;
setCurrentPerformanceSettings(s);
GovernorConfig cfg;
cfg.targetFps = s.targetFps;
cfg.minBudget = std::max<uint64_t>(250'000, s.renderTriangleBudget / 8);
cfg.maxBudget = std::min<uint64_t>(2'000'000'000, std::max<uint64_t>(s.renderTriangleBudget * 4, cfg.minBudget));
+ if (floor) cfg.maxBudget = s.renderTriangleBudget; // (the governor may lower the budget, never raise it)
hw.governor.reset(cfg, s.renderTriangleBudget);
hw.revision = performanceSettingsRevision();
if (!announce) return;
diff --git a/src/app/ProofMode.cpp b/src/app/ProofMode.cpp
index 583165c3..60463425 100644
--- a/src/app/ProofMode.cpp
+++ b/src/app/ProofMode.cpp
@@ -381,6 +381,7 @@ struct PhaseResult {
size_t dabs = 0, samples = 0;
std::vector<double> frameMs, lagMs, lagPx;
std::vector<double> previewLagPx; // the predictive preview's head behind the pointer (the surface's without it)
+ std::vector<double> split[6]; // each frame by part (App::frameSplitMs_, the frame before: the swap comes after)
};
struct SizeResult {
@@ -885,7 +886,10 @@ void App::proofBeforeSwap(int fbW, int fbH) {
nextPhase();
break;
}
- if (ph.frameMs.size() < 1000000 && now - p.stageStart > 0.0) ph.frameMs.push_back(frameMs);
+ if (ph.frameMs.size() < 1000000 && now - p.stageStart > 0.0) {
+ ph.frameMs.push_back(frameMs);
+ for (int k = 0; k < 6; ++k) ph.split[k].push_back(frameSplitMs_[k]);
+ }
const double u = std::min(1.0, (now - p.stageStart) / spec.seconds);
if (spec.radiusPx <= 0) { // orbit: the view turns, as a drag would
camera_.yaw = float(6.2831853 * u);
@@ -1037,6 +1041,12 @@ void App::proofBeforeSwap(int fbW, int fbH) {
j.set("frames", double(ph.frameMs.size()));
j.set("fps", ph.seconds > 0 ? std::round(double(ph.frameMs.size()) / ph.seconds * 10) / 10 : 0.0);
j.set("frame_ms", percentilesJson(percentiles(ph.frameMs)));
+ { // where the frames went (main thread; the solver thread's dabs run beside them, waits are in "sculpt")
+ Json split = Json::object();
+ const char* names[6] = {"events", "sculpt", "ui", "upload", "draw", "swap_wait"};
+ for (int k = 0; k < 6; ++k) split.set(names[k], percentilesJson(percentiles(ph.split[k])));
+ j.set("frame_split_ms", split);
+ }
if (ph.radiusPx > 0) {
if (!ph.lagMs.empty()) { // (Move drags the surface without dabs: no stroke to trail the pointer)
j.set("lag_ms", percentilesJson(percentiles(ph.lagMs)));
diff --git a/src/core/HardwareProfile.cpp b/src/core/HardwareProfile.cpp
index 550237d1..1ba0ea40 100644
--- a/src/core/HardwareProfile.cpp
+++ b/src/core/HardwareProfile.cpp
@@ -118,6 +118,14 @@ const char* tierName(ProfileTier tier) {
return "Laptop";
}
+bool simulatedFloorTier() {
+ static const bool on = [] {
+ const char* v = std::getenv("SF_HW_SIMULATE");
+ return v && std::string(v) == "floor";
+ }();
+ return on;
+}
+
bool tierFromName(const std::string& name, ProfileTier& out) {
const std::string n = lower(name);
for (ProfileTier t : {ProfileTier::Software, ProfileTier::Laptop, ProfileTier::Workstation})
diff --git a/src/core/HardwareProfile.h b/src/core/HardwareProfile.h
index 828c9e51..f9292cfc 100644
--- a/src/core/HardwareProfile.h
+++ b/src/core/HardwareProfile.h
@@ -41,6 +41,9 @@ enum class ProfileTier { Software, Laptop, Workstation };
const char* tierName(ProfileTier tier); // "Software", "Laptop", "Workstation"
// Also accepts "llvmpipe" / "safe" (Software), "budget" (Laptop) and "monster" (Workstation), in any case.
bool tierFromName(const std::string& name, ProfileTier& out);
+// SF_HW_SIMULATE=floor: run with the floor tier's budgets (docs/design/perf-moonshots.md §0: an integrated GPU,
+// GL 3.3, 4 cores) on a faster machine, to measure what such a computer gets. Budgets only, not the GPU's speed.
+bool simulatedFloorTier();
// What the computer is. GPU fields stay empty / 0 where no OpenGL context was probed (sculptforge-cli).
struct HardwareInfo {