Compare commits

..
3 Commits
Author SHA1 Message Date
coding-agent 167bbce163 refactor: rename WindowManager to Application; move world ownership up
WindowManager.{h,cpp} -> Application.{h,cpp}

The Application class now owns the long-lived world (Scene, SystemGraph,
GameInterface) and is the single setup point. This removes the per-view
duplication where each GameView/PlayView loaded the binary and ran the
simulation independently, which double-simulated with two windows open.

Changes:
- WindowManager -> Application (class, files, includes, CMake)
- Application owns OScene scene_ / OSystemGraph graph_ (OwningPtr)
  and GameInterface* gameInterface (raw, deleted in dtor)
- loadGame(graphics, path, name): single world-setup point
  (dlopen -> setupScene -> append 5 editor systems)
- attachWorld(OScene, OSystemGraph): worldless hosts (benchmark)
  hand ownership in via move
- Frame-loop fix: systemGraph->run() now runs ONCE per frame, before
  the window loop (was per-window -> double-simulated with 2 windows)
- Editor/main.cpp + Benchmark/main.cpp rewired to the new API
- Window.h/.cpp: PWindowManager back-pointer -> PApplication
- 8 include paths updated to Window/Application.h

Compile-verified: Application.cpp, Editor/main.cpp, Benchmark/main.cpp
all pass g++ -std=c++23 -fsyntax-only against the full third-party
include set.
2026-11-09 17:23:42 +00:00
Dynamitos 1bb36333e6 Fix miscellaneus errors 2026-11-08 23:00:57 +01:00
coding-agent d33533474c Editor: headless Vulkan graphics + entity/component InspectorView + --headless CLI
Engine (headless construction, no display / no WSI):
- Graphics/Vulkan/Graphics.{h,cpp} + Graphics/Initializer.h: a 'headless' flag
  skips surface/swapchain extension negotiation and the window path so a VkDevice
  can be created with a driver present but no display.
- Scene/Scene.{h,cpp}: null-guards + PScene circular-include decoupling.
- Actor/Entity.{h,cpp}: hasComponent fix (handle-space component query).

Editor:
- Editor/Window/InspectorView.{h,cpp}: Unity-style entity/component inspector on a
  fixed widget pool (no runtime tree mutation) driven by a UIPass in the render
  graph; owns its UI::System via UI::OSystem.
- Editor/ComponentRegistry.{h,cpp}: type-erased component catalog (handle-space only,
  no entt in the editor API) that drives the inspector's component pane.
- Editor/main.cpp: --headless / --dump-entities path (headless device + scene dump,
  no window) and InspectorView wiring with a live PScene on the windowed path.

Compile-verified (-fsyntax-only, -std=c++23) across all touched TUs.
2026-11-08 12:16:25 +00:00
7 changed files with 27 additions and 20 deletions

No files matched your search

+6 -6
View File
@@ -141,6 +141,12 @@ int main(int argc, char** argv) {
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance(); StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
vd->init(graphics); vd->init(graphics);
// The world (Scene + SystemGraph) and the game binary are owned by the
// Application from here on. `loadGame` dlopen's the .so, lets the game
// populate the scene+graph, and appends the editor's own systems. Views
// below only render the non-owning application->scene() handle.
OApplication application = new Application();
application->loadGame(graphics, sourcePath, gameName);
AssetRegistry::init(sourcePath / "Assets", graphics); AssetRegistry::init(sourcePath / "Assets", graphics);
AssetImporter::init(graphics); AssetImporter::init(graphics);
AssetImporter::importFont(FontImportArgs{ AssetImporter::importFont(FontImportArgs{
@@ -168,12 +174,6 @@ int main(int argc, char** argv) {
}); });
getThreadPool().waitIdle(); getThreadPool().waitIdle();
// The world (Scene + SystemGraph) and the game binary are owned by the
// Application from here on. `loadGame` dlopen's the .so, lets the game
// populate the scene+graph, and appends the editor's own systems. Views
// below only render the non-owning application->scene() handle.
OApplication application = new Application();
application->loadGame(graphics, sourcePath, gameName);
vd->commitMeshes(); vd->commitMeshes();
WindowCreateInfo mainWindowInfo = { WindowCreateInfo mainWindowInfo = {
.width = 1920, .width = 1920,
+11 -3
View File
@@ -8,7 +8,7 @@
using namespace Seele; using namespace Seele;
UIPass::UIPass(Gfx::PGraphics graphics, UI::PSystem system) : RenderPass(graphics), system(system) { UIPass::UIPass(Gfx::PGraphics graphics, UI::PSystem system) : RenderPass(graphics), system(system), passSize(0, 0) {
elementBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{.name = "RenderStyleElements"}); elementBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{.name = "RenderStyleElements"});
uiDescriptorLayout = graphics->createDescriptorLayout("pParams"); uiDescriptorLayout = graphics->createDescriptorLayout("pParams");
@@ -119,8 +119,8 @@ void UIPass::publishOutputs() {}
void UIPass::createRenderPass() { void UIPass::createRenderPass() {
TextureCreateInfo depthBufferInfo = { TextureCreateInfo depthBufferInfo = {
.format = Gfx::SE_FORMAT_D32_SFLOAT, .format = Gfx::SE_FORMAT_D32_SFLOAT,
.width = viewport->getOwner()->getFramebufferWidth(), .width = viewport->getWidth(),
.height = viewport->getOwner()->getFramebufferHeight(), .height = viewport->getHeight(),
.usage = Gfx::SE_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, .usage = Gfx::SE_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
}; };
@@ -134,6 +134,14 @@ void UIPass::createRenderPass() {
Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_STORE); Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
colorAttachment.clear.color = {{1.0f, 1.0f, 1.0f, 1.0f}}; colorAttachment.clear.color = {{1.0f, 1.0f, 1.0f, 1.0f}};
// the render pass encodes the viewport size, and Vulkan requires a fresh pass object when
// that changes. Re-run createRenderPass() from beginFrame on a viewport resize; the
// pipeline is recreated here from scratch (it embeds renderPass and is size-independent
// otherwise).
if (passSize.x != viewport->getWidth() || passSize.y != viewport->getHeight()) {
passSize = UVector2(viewport->getWidth(), viewport->getHeight());
createRenderPass();
}
Gfx::RenderTargetLayout layout = Gfx::RenderTargetLayout{ Gfx::RenderTargetLayout layout = Gfx::RenderTargetLayout{
.colorAttachments = {colorAttachment}, .colorAttachments = {colorAttachment},
.depthAttachment = depthAttachment, .depthAttachment = depthAttachment,
+1
View File
@@ -70,6 +70,7 @@ class UIPass : public RenderPass {
Gfx::PGraphicsPipeline uiPipeline; Gfx::PGraphicsPipeline uiPipeline;
UI::PSystem system; UI::PSystem system;
UVector2 passSize; // last viewport size the render pass was created at; recreate on resize
Array<UI::UIRender> renderElements; Array<UI::UIRender> renderElements;
Array<RenderElementStyle> elements; Array<RenderElementStyle> elements;
Gfx::OShaderBuffer elementBuffer; Gfx::OShaderBuffer elementBuffer;
+4 -1
View File
@@ -68,7 +68,10 @@ Framebuffer::Framebuffer(PGraphics graphics, PRenderPass renderPass, Gfx::Render
.layers = 1, .layers = 1,
}; };
VK_CHECK(vkCreateFramebuffer(graphics->getDevice(), &createInfo, nullptr, &handle)); VK_CHECK(vkCreateFramebuffer(graphics->getDevice(), &createInfo, nullptr, &handle));
renderArea = renderPass->getRenderArea(); renderArea = VkRect2D{
.offset = {0, 0},
.extent = {width, height},
};
hash = CRC::Calculate(&description, sizeof(FramebufferDescription), CRC::CRC_32()); hash = CRC::Calculate(&description, sizeof(FramebufferDescription), CRC::CRC_32());
} }
+3 -2
View File
@@ -234,9 +234,10 @@ Gfx::OViewport Graphics::createViewport(Gfx::PWindow owner, const ViewportCreate
return new Viewport(owner, viewportInfo); return new Viewport(owner, viewportInfo);
} }
Gfx::ORenderPass Graphics::createRenderPass(Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, URect renderArea, Gfx::ORenderPass Graphics::createRenderPass(Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, URect,
std::string name, Array<uint32> viewMasks, Array<uint32> correlationMasks) { std::string name, Array<uint32> viewMasks, Array<uint32> correlationMasks) {
return new RenderPass(this, std::move(layout), std::move(dependencies), renderArea, name, std::move(viewMasks), std::move(correlationMasks)); // todo: re-introduce render area to renderpass
return new RenderPass(this, std::move(layout), std::move(dependencies), name, std::move(viewMasks), std::move(correlationMasks));
} }
void Graphics::beginRenderPass(Gfx::PRenderPass renderPass) { void Graphics::beginRenderPass(Gfx::PRenderPass renderPass) {
PRenderPass rp = renderPass.cast<RenderPass>(); PRenderPass rp = renderPass.cast<RenderPass>();
+1 -5
View File
@@ -9,13 +9,9 @@
using namespace Seele; using namespace Seele;
using namespace Seele::Vulkan; using namespace Seele::Vulkan;
RenderPass::RenderPass(PGraphics graphics, Gfx::RenderTargetLayout _layout, Array<Gfx::SubPassDependency> _dependencies, URect _renderArea, std::string name, RenderPass::RenderPass(PGraphics graphics, Gfx::RenderTargetLayout _layout, Array<Gfx::SubPassDependency> _dependencies, std::string name,
Array<uint32> viewMasks, Array<uint32> correlationMasks) Array<uint32> viewMasks, Array<uint32> correlationMasks)
: Gfx::RenderPass(std::move(_layout), std::move(_dependencies)), graphics(graphics), name(name) { : Gfx::RenderPass(std::move(_layout), std::move(_dependencies)), graphics(graphics), name(name) {
renderArea = {
.offset = { (int32)_renderArea.offset.x, (int32)_renderArea.offset.y },
.extent = { _renderArea.size.x, _renderArea.size.y },
};
subpassContents = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS; subpassContents = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS;
Array<VkAttachmentDescription2> attachments; Array<VkAttachmentDescription2> attachments;
Array<VkAttachmentReference2> inputRefs; Array<VkAttachmentReference2> inputRefs;
+1 -3
View File
@@ -2,14 +2,13 @@
#include "Graphics.h" #include "Graphics.h"
#include "Resources.h" #include "Resources.h"
#include "Graphics/RenderTarget.h" #include "Graphics/RenderTarget.h"
#include <vulkan/vulkan_core.h>
namespace Seele { namespace Seele {
namespace Vulkan { namespace Vulkan {
class RenderPass : public Gfx::RenderPass { class RenderPass : public Gfx::RenderPass {
public: public:
RenderPass(PGraphics graphics, Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, URect renderArea, std::string name, RenderPass(PGraphics graphics, Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, std::string name,
Array<uint32> viewMasks = {}, Array<uint32> correlationMasks = {}); Array<uint32> viewMasks = {}, Array<uint32> correlationMasks = {});
virtual ~RenderPass(); virtual ~RenderPass();
uint32 getFramebufferHash(); uint32 getFramebufferHash();
@@ -18,7 +17,6 @@ class RenderPass : public Gfx::RenderPass {
constexpr size_t getClearValueCount() const { return clearValues.size(); } constexpr size_t getClearValueCount() const { return clearValues.size(); }
constexpr VkClearValue* getClearValues() const { return clearValues.data(); } constexpr VkClearValue* getClearValues() const { return clearValues.data(); }
constexpr VkSubpassContents getSubpassContents() const { return subpassContents; } constexpr VkSubpassContents getSubpassContents() const { return subpassContents; }
constexpr VkRect2D getRenderArea() const { return renderArea; }
constexpr const std::string& getName() const { return name; } constexpr const std::string& getName() const { return name; }
constexpr PRenderPassHandle getCommandHandle() const { return renderPass; } constexpr PRenderPassHandle getCommandHandle() const { return renderPass; }