mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 05:52:33 +00:00
ifcviewer: move wgpu lifecycle state ownership into ViewportCore
First chunk of the #84 ViewportCore extraction. The seven wgpu lifecycle handles (instance, adapter, device, queue, surface, surface_format, surface_configured) now live as ViewportCore members; ViewportWindow keeps reference aliases pointing at ViewportCore's storage so its existing render-method bodies don't need a `core_.` prefix added at every call site — 230+ touches deferred until each method moves across. Member init order in ViewportWindow's constructor: core_(this) → constructs ViewportCore with host_=this instance_(core_.instance_) → binds the alias to core_'s field … same for adapter/device/queue/surface/… Friend declaration on ViewportCore::ViewportWindow lets the references bind to its private fields. The friend bond shrinks each commit as render methods (and their `device_` / `queue_` references) migrate into ViewportCore proper; the goal state is no friend and no aliases. Next #84 chunks (separate commits) move pipelines, models_gpu_, pool_, streaming_thread_, then the render/cull/encode methods. Each leaves the desktop build green. Builds: desktop / bonsai / web all green. Tests 100/100.
This commit is contained in:
@@ -634,16 +634,25 @@ private:
|
||||
void recomposeAndUploadModel(uint32_t model_id);
|
||||
|
||||
bool wgpu_initialized_ = false;
|
||||
bool surface_configured_ = false;
|
||||
int configured_w_ = 0;
|
||||
int configured_h_ = 0;
|
||||
|
||||
WGPUInstance instance_ = nullptr;
|
||||
WGPUAdapter adapter_ = nullptr;
|
||||
WGPUDevice device_ = nullptr;
|
||||
WGPUQueue queue_ = nullptr;
|
||||
WGPUSurface surface_ = nullptr;
|
||||
WGPUTextureFormat surface_format_ = WGPUTextureFormat_Undefined;
|
||||
// ---- wgpu lifecycle state aliases ----------------------------------
|
||||
//
|
||||
// Actual storage lives in core_ (declared below; ViewportWindow is a
|
||||
// friend of ViewportCore so these references can bind). Existing
|
||||
// member-access sites in ViewportWindow.cpp keep working unchanged —
|
||||
// they just resolve to core_.device_ etc. through these references.
|
||||
// Each one is removed when its owning render method moves into
|
||||
// ViewportCore (#84-b onwards).
|
||||
ViewportCore core_;
|
||||
WGPUInstance& instance_;
|
||||
WGPUAdapter& adapter_;
|
||||
WGPUDevice& device_;
|
||||
WGPUQueue& queue_;
|
||||
WGPUSurface& surface_;
|
||||
WGPUTextureFormat& surface_format_;
|
||||
bool& surface_configured_;
|
||||
|
||||
// Render pipeline + bind group layouts (built once after init).
|
||||
WGPUShaderModule main_shader_module_ = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user