mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 13:58:12 +00:00
ifcviewer: move scene state into ViewportCore (#84-c)
Move the five scene-state fields that drive per-model GPU upload + the
streaming residency loop into ViewportCore:
BufferPool pool_ — vertex+index sub-allocator
StreamingThread streaming_thread_ — background chunk reader
std::unordered_map<uint32_t, ModelGpuData> models_gpu_
— per-model state
uint32_t next_model_id_ — model-id allocator
uint32_t next_object_id_ — globally-unique object-id allocator
ViewportCore.h gains transitive includes for BufferPool / StreamingThread
/ ModelGpuData; ViewportWindow keeps the same names as reference aliases
so existing method bodies that touch them don't have to change.
Same risk profile as #84-a and #84-b: the storage moved but the values
are still set and consumed by the same code paths, so behaviour stays
identical.
Builds: desktop / bonsai / web all green. Tests 100/100.
This commit is contained in:
@@ -35,6 +35,12 @@
|
||||
|
||||
#include <webgpu/webgpu.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "BufferPool.h"
|
||||
#include "ModelGpuData.h"
|
||||
#include "StreamingThread.h"
|
||||
#include "ViewportHost.h"
|
||||
|
||||
class ViewportCore {
|
||||
@@ -102,6 +108,27 @@ private:
|
||||
// Pick pass. Reuses pipeline_layout_ — same set of bindings as the
|
||||
// main pass since the pick fragment also vertex-pulls instance data.
|
||||
WGPURenderPipeline pick_pipeline_ = nullptr;
|
||||
|
||||
// ---- Scene state ---------------------------------------------------------
|
||||
//
|
||||
// Sub-allocator for chunk vertex + index buffers. All per-chunk
|
||||
// pool slices come from here; nothing else uses it. Replaces the
|
||||
// old hand-picked streaming_vram_budget_bytes_ knob entirely.
|
||||
BufferPool pool_;
|
||||
|
||||
// Background worker that does scatter-gather chunk reads off the
|
||||
// render thread. driveStreamingLoads enqueues requests for visible
|
||||
// non-resident chunks and drains completed results into the pool
|
||||
// on subsequent frames.
|
||||
StreamingThread streaming_thread_;
|
||||
|
||||
// Per-model GPU + CPU state, keyed by viewport-assigned model_id.
|
||||
std::unordered_map<uint32_t, ModelGpuData> models_gpu_;
|
||||
uint32_t next_model_id_ = 1;
|
||||
// Globally-unique object_id allocator. Each applyCachedModel rebases
|
||||
// the sidecar's local object_ids by base_object_id_so_far so picks
|
||||
// are unambiguous across models.
|
||||
uint32_t next_object_id_ = 1;
|
||||
};
|
||||
|
||||
#endif // VIEWPORTCORE_H
|
||||
|
||||
Reference in New Issue
Block a user