wgpu backend: --camera flag + request adapter's max buffer limits

Two pieces that block proper side-by-side parity with the GL minimal:

1. --camera tx,ty,tz,dist,yaw,pitch. Same format string as the GL
   minimal so a pasted camera arg lands the same view on both backends.
   setCamera() also flips initial_view_applied_ = true so the auto-
   viewAll-on-first-load doesn't snap away from the script-set position
   when the model finishes uploading.

2. Real BIM models exceed the conservative WebGPU defaults at device
   create time. A 114k-instance / 19M-index sidecar's vertex storage is
   139 MB, which trips wgpu's default 128 MB max_storage_buffer_binding_
   size and bind-group creation fails. Now wgpuAdapterGetLimits is
   called first and the device is requested at the adapter's full
   ceiling — every desktop driver supports multi-GB.

   Trade-off worth flagging: web parity will fail here because browsers
   cap at the defaults. The eventual fix is to split a model's vertex/
   instance storage into ≤128 MB chunks with a small per-frame routing
   table, which is a real chunk of work. For now this unblocks all the
   native benchmarking the user is actually doing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-05-27 14:58:18 +10:00
parent f9a9273ecc
commit 7893135790
3 changed files with 55 additions and 2 deletions
+9 -2
View File
@@ -72,10 +72,17 @@ public:
size_t modelCount() const { return models_gpu_.size(); }
// Frame the union of all loaded models' world AABBs. No-op on empty
// scenes. Called automatically after the first model loads; clients
// can re-invoke to re-frame.
// scenes. Called automatically after the first model loads (unless
// setCamera was already invoked); clients can re-invoke to re-frame.
void viewAll();
// Explicit camera state, mirroring the GL ViewportWindow API. Suppresses
// the auto-viewAll on first load so a script-driven camera survives
// model loading. Parameters match the GL --camera tx,ty,tz,dist,yaw,pitch
// order so a pasted camera string lands the same view in both backends.
void setCamera(float tx, float ty, float tz,
float dist, float yaw_deg, float pitch_deg);
// Queue a one-shot framebuffer capture: the next rendered frame is
// copied back to host memory and saved to `path` as PNG. If
// `quit_after` is true, QCoreApplication::quit() is called once the