Fix miscellaneus errors

This commit is contained in:
Dynamitos committed 2026-11-09 20:07:40 +01:00
1 parent c5c66f8cf3
commit 803531c608
17 files changed
+141 -83

No files matched your search

+80 -27
View File
@@ -1,5 +1,27 @@
import lldb
def _member(valobj, name):
# GetChildMemberWithName does not search base classes reliably across
# LLDB versions; walk base classes explicitly, mirroring the working
# gdb _base_cast/_member in Seele.py.
child = valobj.GetChildMemberWithName(name)
if child.IsValid():
return child
t = valobj.GetType()
seen = set()
while t.IsValid() and t not in seen:
seen.add(t)
for i in range(t.GetNumBases()):
base = t.GetBaseClass(i)
if base.IsValid():
sub = valobj.GetBaseClassWithName(base.GetName())
if sub.IsValid():
child = sub.GetChildMemberWithName(name)
if child.IsValid():
return child
t = t.GetBaseClass(0) if t.GetNumBases() > 0 else None
return None
def Array_SummaryProvider(valobj, internal_dict):
size = valobj.GetChildMemberWithName('arraySize').GetValueAsUnsigned(0)
return f"Array(size={size})"
@@ -65,8 +87,8 @@ class ListSyntheticProvider:
return True
def Tree_SummaryProvider(valobj, internal_dict):
size = valobj.GetChildMemberWithName('_size').GetValueAsUnsigned(0)
return f"Tree(size={size})"
size = _member(valobj, '_size')
return f"Tree(size={size.GetValueAsUnsigned(0) if size and size.IsValid() else '?'})"
class TreeSyntheticProvider:
def __init__(self, valobj, internal_dict):
@@ -87,28 +109,35 @@ class TreeSyntheticProvider:
return None
# Collect all nodes via in-order traversal, then return the one at `index`
nodes = []
self._collect(self.root, nodes)
if self.root and self.root.IsValid():
self._collect(self.root, nodes)
if index >= len(nodes):
return None
return nodes[index].GetChildMemberWithName('data')
data = nodes[index].GetChildMemberWithName('data')
return data if data.IsValid() else None
def _collect(self, node, out):
if not node.IsValid():
return
self._collect(node.GetChildMemberWithName('leftChild'), out)
left = node.GetChildMemberWithName('leftChild')
if left.IsValid():
self._collect(left.Dereference(), out)
out.append(node)
self._collect(node.GetChildMemberWithName('rightChild'), out)
right = node.GetChildMemberWithName('rightChild')
if right.IsValid():
self._collect(right.Dereference(), out)
def update(self):
self.root = self.valobj.GetChildMemberWithName('root')
self.size = self.valobj.GetChildMemberWithName('_size').GetValueAsUnsigned(0)
self.root = _member(self.valobj, 'root')
size = _member(self.valobj, '_size')
self.size = size.GetValueAsUnsigned(0) if size and size.IsValid() else 0
def has_children(self):
return True
return self.size > 0
def Set_SummaryProvider(valobj, internal_dict):
size = valobj.GetChildMemberWithName('_size').GetValueAsUnsigned(0)
return f"Set(size={size})"
size = _member(valobj, '_size')
return f"Set(size={size.GetValueAsUnsigned(0) if size and size.IsValid() else '?'})"
class SetSyntheticProvider:
def __init__(self, valobj, internal_dict):
@@ -128,28 +157,39 @@ class SetSyntheticProvider:
if index < 0 or index >= self.size:
return None
nodes = []
self._collect(self.root, nodes)
# Start from pseudoRoot: the splay tree's actual structure is
# connected via pseudoRoot.leftChild, not the `root` pointer.
if self.pseudoRoot and self.pseudoRoot.IsValid():
left = self.pseudoRoot.GetChildMemberWithName('leftChild')
if left.IsValid():
self._collect(left.Dereference(), nodes)
if index >= len(nodes):
return None
return nodes[index].GetChildMemberWithName('data')
data = nodes[index].GetChildMemberWithName('data')
return data if data.IsValid() else None
def _collect(self, node, out):
if not node.IsValid():
return
self._collect(node.GetChildMemberWithName('leftChild'), out)
left = node.GetChildMemberWithName('leftChild')
if left.IsValid():
self._collect(left.Dereference(), out)
out.append(node)
self._collect(node.GetChildMemberWithName('rightChild'), out)
right = node.GetChildMemberWithName('rightChild')
if right.IsValid():
self._collect(right.Dereference(), out)
def update(self):
self.root = self.valobj.GetChildMemberWithName('root')
self.size = self.valobj.GetChildMemberWithName('_size').GetValueAsUnsigned(0)
self.pseudoRoot = _member(self.valobj, 'pseudoRoot')
size = _member(self.valobj, '_size')
self.size = size.GetValueAsUnsigned(0) if size and size.IsValid() else 0
def has_children(self):
return True
return self.size > 0
def Map_SummaryProvider(valobj, internal_dict):
size = valobj.GetChildMemberWithName('_size').GetValueAsUnsigned(0)
return f"Map(size={size})"
size = _member(valobj, '_size')
return f"Map(size={size.GetValueAsUnsigned(0) if size and size.IsValid() else '?'})"
class MapSyntheticProvider:
def __init__(self, valobj, internal_dict):
@@ -169,24 +209,37 @@ class MapSyntheticProvider:
if index < 0 or index >= self.size:
return None
nodes = []
self._collect(self.root, nodes)
# Start from pseudoRoot: the splay tree's actual structure is
# connected via pseudoRoot.leftChild, not the `root` pointer.
if self.pseudoRoot and self.pseudoRoot.IsValid():
left = self.pseudoRoot.GetChildMemberWithName('leftChild')
if left.IsValid():
self._collect(left.Dereference(), nodes)
if index >= len(nodes):
return None
return nodes[index].GetChildMemberWithName('data')
# Map stores Pair<K, V> in node.data; return the pair so the
# debugger can show key/value members (Pair is a plain struct).
data = nodes[index].GetChildMemberWithName('data')
return data if data.IsValid() else None
def _collect(self, node, out):
if not node.IsValid():
return
self._collect(node.GetChildMemberWithName('leftChild'), out)
left = node.GetChildMemberWithName('leftChild')
if left.IsValid():
self._collect(left.Dereference(), out)
out.append(node)
self._collect(node.GetChildMemberWithName('rightChild'), out)
right = node.GetChildMemberWithName('rightChild')
if right.IsValid():
self._collect(right.Dereference(), out)
def update(self):
self.root = self.valobj.GetChildMemberWithName('root')
self.size = self.valobj.GetChildMemberWithName('_size').GetValueAsUnsigned(0)
self.pseudoRoot = _member(self.valobj, 'pseudoRoot')
size = _member(self.valobj, '_size')
self.size = size.GetValueAsUnsigned(0) if size and size.IsValid() else 0
def has_children(self):
return True
return self.size > 0
def Vector_SummaryProvider(valobj, internal_dict):
# Get the template parameters to determine vector length
+3 -1
View File
@@ -359,7 +359,9 @@ struct CookTorrance : IBRDF
const float MAX_REFLECTION_LOD = 4;
float3 prefilteredColor = pLightEnv.prefilteredMap.SampleLevel(pLightEnv.irradianceSampler, r, roughness * MAX_REFLECTION_LOD).xyz;
float2 envBRDF = pLightEnv.brdfLUT.Sample(pLightEnv.lutSampler, float2(max(dot(normal, viewDir_WS), 0), roughness)).rg;
// brdfLUT has no mip levels and is indexed analytically (N·V, roughness) with no screen
// derivatives, so implicit LOD is unavailable (GLCompute/Ray) and meaningless: use level 0.
float2 envBRDF = pLightEnv.brdfLUT.SampleLevel(pLightEnv.lutSampler, float2(max(dot(normal, viewDir_WS), 0), roughness), 0).rg;
float3 specular = prefilteredColor * (F * envBRDF.x + envBRDF.y);
return (k_d * diffuse + specular) * ambientOcclusion;
+1 -1
View File
@@ -68,7 +68,7 @@ struct DrawCallOffsets
};
#ifdef RAY_TRACING
// Shader record buffers are accessed via a different mechanism and don't use descriptor set bindings
layout(set = 15, shaderRecordEXT)
layout(shaderRecordEXT)
#else
layout(push_constant)
#endif
+2 -1
View File
@@ -7,6 +7,7 @@ void miss(inout RayPayload p)
// p.shading.normal = -WorldRayDirection();
// p.shading.normalLight = -WorldRayDirection();
// p.material.color = float4(0, 0, 0, 0);
p.light = float3(pRayTracingParams.skyBox.Sample(pRayTracingParams.skyBoxSampler, WorldRayDirection()).xyz);
// miss shaders (GLCompute) can't do ImplicitLod (mip) sampling; use a fixed level
p.light = float3(pRayTracingParams.skyBox.SampleLevel(pRayTracingParams.skyBoxSampler, WorldRayDirection(), 0).xyz);
p.hit = false;
}
+3 -2
View File
@@ -1,12 +1,13 @@
#include "PlayView.h"
#include "Scene/Scene.h"
#include "Window/Window.h"
#include <fmt/format.h>
#include <fstream>
using namespace Seele;
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::string dllPath, bool useMeshCulling)
: GameView(graphics, window, createInfo, dllPath) {
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo, bool useMeshCulling)
: GameView(graphics, window, scene, createInfo) {
getGlobals().useDepthCulling = useMeshCulling;
renderTimestamp = graphics->createTimestampQuery(2, "RenderTimestamp");
queryThread = std::thread([&]() {
+1 -1
View File
@@ -4,7 +4,7 @@
namespace Seele {
class PlayView : public GameView {
public:
PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::string dllPath, bool useMeshCulling);
PlayView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo, bool useMeshCulling);
virtual ~PlayView();
virtual void beginUpdate() override;
virtual void update() override;
+1 -1
View File
@@ -49,7 +49,7 @@ int main(int argc, char** argv) {
.offset = {0, 0},
},
};
OGameView sceneView = new PlayView(graphics, window, sceneViewInfo, binaryPath.generic_string(), useDepthCulling);
OGameView sceneView = new PlayView(graphics, window, new Scene(graphics), sceneViewInfo, useDepthCulling);
sceneView->setFocused();
while (windowManager->isActive()) {
+3 -1
View File
@@ -3,4 +3,6 @@ add_subdirectory(Window/)
target_sources(Editor
PRIVATE
main.cpp)
main.cpp
ComponentRegistry.h
ComponentRegistry.cpp)
+2 -2
View File
@@ -7,8 +7,8 @@
using namespace Seele;
using namespace Seele::Editor;
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::filesystem::path dllPath)
: GameView(graphics, window, createInfo, dllPath) {}
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo)
: GameView(graphics, window, scene, createInfo) {}
PlayView::~PlayView() {}
+1 -1
View File
@@ -5,7 +5,7 @@ namespace Seele {
namespace Editor {
class PlayView : public GameView {
public:
PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::filesystem::path dllPath);
PlayView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo);
virtual ~PlayView();
virtual void beginUpdate() override;
virtual void update() override;
+26 -13
View File
@@ -10,7 +10,12 @@
#include "Material/Material.h"
#include "Graphics/Vulkan/Graphics.h"
#include "Graphics/StaticMeshVertexData.h"
#include "System/SystemGraph.h"
#include "Window/PlayView.h"
#include "System/CameraUpdater.h"
#include "System/FluidUpdater.h"
#include "System/LightGather.h"
#include "System/MeshUpdater.h"
#include "Window/WindowManager.h"
#include "Window/InspectorView.h"
#include "Scene/Scene.h" // OScene/Scene - the InspectorView's entity pane needs a live scene
@@ -136,7 +141,18 @@ int main(int argc, char** argv) {
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
vd->init(graphics);
OWindowManager windowManager = new WindowManager();
GameInterface gameInterface(binaryPath);
OScene scene = new Scene(graphics);
gameInterface.reload();
OSystemGraph systemGraph = new SystemGraph();
gameInterface.getGame()->setupScene(scene, systemGraph);
systemGraph->addSystem(new System::KeyboardInput(scene));
systemGraph->addSystem(new System::FluidUpdater(scene));
systemGraph->addSystem(new System::LightGather(scene));
systemGraph->addSystem(new System::MeshUpdater(scene));
systemGraph->addSystem(new System::CameraUpdater(scene));
OWindowManager windowManager = new WindowManager(systemGraph);
AssetRegistry::init(sourcePath / "Assets", graphics);
AssetImporter::init(graphics);
AssetImporter::importFont(FontImportArgs{
@@ -172,18 +188,15 @@ int main(int argc, char** argv) {
.preferredFormat = Gfx::SE_FORMAT_B8G8R8A8_SRGB,
};
auto window = windowManager->addWindow(graphics, mainWindowInfo);
// ViewportCreateInfo sceneViewInfo = {
// .dimensions =
// {
// .size = {1920, 1080},
// .offset = {0, 0},
// },
// };
// OGameView sceneView = new Editor::PlayView(graphics, window, sceneViewInfo, binaryPath);
// sceneView->setFocused();
// The windowed editor path has no pre-existing scene; the InspectorView's entity
// pane needs one to enumerate. Create a fresh Scene on the live (windowed) device.
OScene scene = new Scene(graphics);
ViewportCreateInfo sceneViewInfo = {
.dimensions =
{
.size = {1920, 1080},
.offset = {0, 0},
},
};
OGameView sceneView = new Editor::PlayView(graphics, window, scene, sceneViewInfo);
sceneView->setFocused();
OInspectorView inspectorView = new Editor::InspectorView(graphics, window,
ViewportCreateInfo{
.dimensions =
@@ -142,6 +142,10 @@ void UIPass::createRenderPass() {
passSize = UVector2(viewport->getWidth(), viewport->getHeight());
createRenderPass();
}
Gfx::RenderTargetLayout layout = Gfx::RenderTargetLayout{
.colorAttachments = {colorAttachment},
.depthAttachment = depthAttachment,
};
Array<Gfx::SubPassDependency> dependency = {
{
.srcSubpass = ~0U,
+1 -1
View File
@@ -1009,7 +1009,7 @@ void Graphics::pickPhysicalDevice() {
shaderFloatControls = true;
}
}
rayTracingEnabled = rayTracingPipelineSupport && accelerationStructureSupport && hostOperationsSupport && deviceAddressSupport &&
rayTracingEnabled = false && rayTracingPipelineSupport && accelerationStructureSupport && hostOperationsSupport && deviceAddressSupport &&
descriptorIndexingSupport && spirv14Support && shaderFloatControls;
}
+4 -25
View File
@@ -4,25 +4,18 @@
#include "Graphics/RenderPass/BasePass.h"
#include "Graphics/RenderPass/CachedDepthPass.h"
#include "Graphics/RenderPass/DepthCullingPass.h"
#include "Graphics/RenderPass/FluidRenderPass.h"
#include "Graphics/RenderPass/LightCullingPass.h"
#include "Graphics/RenderPass/RayTracingPass.h"
#include "Graphics/RenderPass/ShadowPass.h"
#include "Graphics/RenderPass/SimulationComputePass.h"
#include "Graphics/RenderPass/SurfaceExtractPass.h"
#include "Graphics/RenderPass/ToneMappingPass.h"
#include "Graphics/RenderPass/VisibilityPass.h"
#include "System/CameraUpdater.h"
#include "System/FluidUpdater.h"
#include "System/LightGather.h"
#include "System/MeshUpdater.h"
#include "Window/Window.h"
#include "Scene/LightEnvironment.h"
using namespace Seele;
GameView::GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::filesystem::path dllPath)
: View(graphics, window, createInfo, "Game"), graphics(graphics), scene(new Scene(graphics)), gameInterface(dllPath) {
GameView::GameView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo)
: View(graphics, window, createInfo, "Game"), graphics(graphics), scene(scene) {
reloadGame();
renderGraph.addPass(new CachedDepthPass(graphics, scene));
renderGraph.addPass(new DepthCullingPass(graphics, scene));
@@ -56,7 +49,6 @@ void GameView::update() {
for (VertexData* vd : VertexData::getList()) {
vd->resetMeshData();
}
systemGraph->run(updateTime);
scene->update(updateTime);
for (VertexData* vd : VertexData::getList()) {
vd->createDescriptors();
@@ -94,29 +86,16 @@ void GameView::applyArea(URect) {
}
void GameView::reloadGame() {
gameInterface.reload();
systemGraph = new SystemGraph();
gameInterface.getGame()->setupScene(scene, systemGraph);
System::OKeyboardInput keyInput = new System::KeyboardInput(scene);
keyboardSystem = keyInput;
systemGraph->addSystem(std::move(keyInput));
systemGraph->addSystem(new System::FluidUpdater(scene));
systemGraph->addSystem(new System::LightGather(scene));
systemGraph->addSystem(new System::MeshUpdater(scene));
systemGraph->addSystem(new System::CameraUpdater(scene));
}
void GameView::keyCallback(KeyCode code, InputAction action, KeyModifierFlags modifier) {
keyboardSystem->keyCallback(code, action, modifier);
}
void GameView::mouseMoveCallback(double xPos, double yPos) { keyboardSystem->mouseCallback(xPos, yPos); }
void GameView::mouseMoveCallback(double xPos, double yPos) { }
void GameView::mouseButtonCallback(MouseButton button, InputAction action, KeyModifierFlags modifier) {
keyboardSystem->mouseButtonCallback(button, action, modifier);
}
void GameView::scrollCallback(double xScroll, double yScroll) { keyboardSystem->scrollCallback(xScroll, yScroll); }
void GameView::scrollCallback(double xScroll, double yScroll) { }
void GameView::fileCallback(int, const char**) {}
+2 -4
View File
@@ -12,7 +12,7 @@
namespace Seele {
class GameView : public View {
public:
GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::filesystem::path dllPath);
GameView(Gfx::PGraphics graphics, PWindow window, PScene scene, const ViewportCreateInfo& createInfo);
virtual ~GameView();
virtual void beginUpdate() override;
virtual void update() override;
@@ -26,12 +26,10 @@ class GameView : public View {
protected:
virtual void applyArea(URect rect) override;
Gfx::PGraphics graphics;
OScene scene;
GameInterface gameInterface;
PScene scene;
RenderGraph renderGraph;
RenderGraph rayTracingGraph;
OSystemGraph systemGraph;
System::PKeyboardInput keyboardSystem;
float updateTime = 0;
+4 -1
View File
@@ -1,9 +1,11 @@
#include "WindowManager.h"
#include "Graphics/Enums.h"
#include "Graphics/Graphics.h"
#include "System/SystemGraph.h"
using namespace Seele;
WindowManager::WindowManager() {}
WindowManager::WindowManager(PSystemGraph systemGraph) : systemGraph(systemGraph) {}
WindowManager::~WindowManager() {}
@@ -18,6 +20,7 @@ void WindowManager::render() {
window->pollInputs();
if (window->isPaused())
continue;
systemGraph->run(Gfx::getCurrentFrameDelta());
window->render();
}
}
+3 -1
View File
@@ -1,12 +1,13 @@
#pragma once
#include "Containers/Array.h"
#include "System/SystemGraph.h"
#include "Window.h"
namespace Seele {
DECLARE_NAME_REF(Gfx, Graphics)
class WindowManager {
public:
WindowManager();
WindowManager(PSystemGraph systemGraph);
~WindowManager();
OWindow addWindow(Gfx::PGraphics graphics, const WindowCreateInfo& createInfo);
void render();
@@ -15,6 +16,7 @@ class WindowManager {
private:
Array<PWindow> windows;
PSystemGraph systemGraph;
};
DEFINE_REF(WindowManager)
} // namespace Seele