Split Application into Project + Application to support multiple windows under one project #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Applicationcurrently does two unrelated jobs: it owns the runtime (Window, Device, RenderContext, AssetRegistry — seeApplication::Implin application.cpp) and it's the base class users subclass for lifecycle hooks (onCreate/onUpdate/onRender/onDestroy). Because of this, everyApplicationgets its ownDeviceandAssetRegistry, so there's no way to run multiple windows (e.g. an editor window + a game preview window) that share loaded assets and GPU resources.Proposal
Projectowns the shared runtime:DeviceandAssetRegistry. This is the thing a user would import/construct first.Applicationbecomes a lighter-weight, subclassable window: owns aWindow+RenderContext, exposes theonCreate/onUpdate/onRender/onDestroyhooks, and references its parentProjectfor assets/device access.Projectcan own multipleApplications at once.Blocker / required refactor
Devicecurrently takes aWindow*directly (device.hpp:40) and owns that window'svk::SurfaceKHR. That means device creation is 1:1 with a single window today. To make this work,Deviceneeds to split into:Project.Application'sRenderContext.This is the bulk of the actual work; the
Project/Applicationclass split itself is comparatively small.Moving to Blocked since no project requires multiple windows yet