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.
This commit is contained in:
coding-agent authored and Dynamitos committed 2026-11-09 20:07:40 +01:00
1 parent 499407d366
commit c5c66f8cf3
12 files changed
+830 -46

No files matched your search

+36 -3
View File
@@ -186,7 +186,7 @@ VkDeviceAddress vkGetAccelerationStructureDeviceAddressKHR(VkDevice device, cons
return getAccelerationStructureDeviceAddress(device, pInfo);
}
Graphics::Graphics() : instance(VK_NULL_HANDLE), handle(VK_NULL_HANDLE), physicalDevice(VK_NULL_HANDLE), callback(VK_NULL_HANDLE) {}
Graphics::Graphics() : instance(VK_NULL_HANDLE), handle(VK_NULL_HANDLE), physicalDevice(VK_NULL_HANDLE), callback(VK_NULL_HANDLE), headless(false) {}
Graphics::~Graphics() {
pipelineCache = nullptr;
@@ -202,6 +202,10 @@ Graphics::~Graphics() {
}
void Graphics::init(GraphicsInitializer initInfo) {
// Capture headless before initInstance so getRequiredExtensions / initInstance /
// createDevice can all branch on it. In headless mode we intentionally skip GLFW
// init, all WSI surface extensions, and the swapchain device extension.
headless = initInfo.headless;
initInstance(initInfo);
setupDebugCallback();
pickPhysicalDevice();
@@ -728,6 +732,25 @@ Array<const char*> Graphics::getRequiredExtensions() {
return hasInstanceExtension(availableExtensions, extensionName);
};
// Headless: no WSI surface support at all. We do not query GLFW (it fails to
// init without a display) and we do not request any surface extension. The
// instance is still valid for descriptor/pipeline layouts, queues, and
// device-local resources — only window/swapchain paths are unavailable.
if (headless) {
#ifdef ENABLE_VALIDATION
extensions.addUnique(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
#endif
Array<const char*> validatedExtensions;
for (uint32 i = 0; i < extensions.size(); ++i) {
if (supportsExtension(extensions[i])) {
validatedExtensions.addUnique(extensions[i]);
} else {
std::cerr << "Warning: Vulkan instance extension not exposed by loader, skipping: " << extensions[i] << std::endl;
}
}
return validatedExtensions;
}
unsigned int glfwExtensionCount = 0;
const char** glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
@@ -830,7 +853,12 @@ Array<const char*> Graphics::getRequiredExtensions() {
}
void Graphics::initInstance(GraphicsInitializer initInfo) {
initializeGlfwForVulkan();
// In headless mode there is no display, so GLFW cannot be initialized. Skip it
// entirely; getRequiredExtensions() already returns a surface-less set in this
// case. Everything else (instance, device, queues) proceeds normally.
if (!headless) {
initializeGlfwForVulkan();
}
VkApplicationInfo appInfo = {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pNext = nullptr,
@@ -1056,7 +1084,12 @@ void Graphics::createDevice(GraphicsInitializer initializer) {
*currentPriority++ = 0.0f;
}
}
initializer.deviceExtensions.add(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
// In headless mode there is no swapchain (no window / no surface), so the
// swapchain device extension must not be requested. It is only needed for
// creating swapchain image views, which a headless device never does.
if (!headless) {
initializer.deviceExtensions.add(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
}
if (supportMeshShading()) {
initializer.deviceExtensions.add(VK_EXT_MESH_SHADER_EXTENSION_NAME);
features.get<VkPhysicalDeviceVulkan12Features>().pNext = &meshFeatures.get();