Engine is up and running

This commit is contained in:
Dynamitos committed 2026-11-09 20:07:40 +01:00
1 parent 1e34f0e67b
commit 1f7e7e0541
7 files changed
+20 -27

No files matched your search

+6 -6
View File
@@ -141,12 +141,6 @@ int main(int argc, char** argv) {
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
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);
AssetImporter::init(graphics);
AssetImporter::importFont(FontImportArgs{
@@ -174,6 +168,12 @@ int main(int argc, char** argv) {
});
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();
WindowCreateInfo mainWindowInfo = {
.width = 1920,
+3 -11
View File
@@ -8,7 +8,7 @@
using namespace Seele;
UIPass::UIPass(Gfx::PGraphics graphics, UI::PSystem system) : RenderPass(graphics), system(system), passSize(0, 0) {
UIPass::UIPass(Gfx::PGraphics graphics, UI::PSystem system) : RenderPass(graphics), system(system) {
elementBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{.name = "RenderStyleElements"});
uiDescriptorLayout = graphics->createDescriptorLayout("pParams");
@@ -119,8 +119,8 @@ void UIPass::publishOutputs() {}
void UIPass::createRenderPass() {
TextureCreateInfo depthBufferInfo = {
.format = Gfx::SE_FORMAT_D32_SFLOAT,
.width = viewport->getWidth(),
.height = viewport->getHeight(),
.width = viewport->getOwner()->getFramebufferWidth(),
.height = viewport->getOwner()->getFramebufferHeight(),
.usage = Gfx::SE_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
};
@@ -134,14 +134,6 @@ void UIPass::createRenderPass() {
Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
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{
.colorAttachments = {colorAttachment},
.depthAttachment = depthAttachment,
-1
View File
@@ -70,7 +70,6 @@ class UIPass : public RenderPass {
Gfx::PGraphicsPipeline uiPipeline;
UI::PSystem system;
UVector2 passSize; // last viewport size the render pass was created at; recreate on resize
Array<UI::UIRender> renderElements;
Array<RenderElementStyle> elements;
Gfx::OShaderBuffer elementBuffer;
+1 -4
View File
@@ -68,10 +68,7 @@ Framebuffer::Framebuffer(PGraphics graphics, PRenderPass renderPass, Gfx::Render
.layers = 1,
};
VK_CHECK(vkCreateFramebuffer(graphics->getDevice(), &createInfo, nullptr, &handle));
renderArea = VkRect2D{
.offset = {0, 0},
.extent = {width, height},
};
renderArea = renderPass->getRenderArea();
hash = CRC::Calculate(&description, sizeof(FramebufferDescription), CRC::CRC_32());
}
+2 -3
View File
@@ -234,10 +234,9 @@ Gfx::OViewport Graphics::createViewport(Gfx::PWindow owner, const ViewportCreate
return new Viewport(owner, viewportInfo);
}
Gfx::ORenderPass Graphics::createRenderPass(Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, URect,
Gfx::ORenderPass Graphics::createRenderPass(Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, URect renderArea,
std::string name, Array<uint32> viewMasks, Array<uint32> 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));
return new RenderPass(this, std::move(layout), std::move(dependencies), renderArea, name, std::move(viewMasks), std::move(correlationMasks));
}
void Graphics::beginRenderPass(Gfx::PRenderPass renderPass) {
PRenderPass rp = renderPass.cast<RenderPass>();
+5 -1
View File
@@ -9,9 +9,13 @@
using namespace Seele;
using namespace Seele::Vulkan;
RenderPass::RenderPass(PGraphics graphics, Gfx::RenderTargetLayout _layout, Array<Gfx::SubPassDependency> _dependencies, std::string name,
RenderPass::RenderPass(PGraphics graphics, Gfx::RenderTargetLayout _layout, Array<Gfx::SubPassDependency> _dependencies, URect _renderArea, std::string name,
Array<uint32> viewMasks, Array<uint32> correlationMasks)
: 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;
Array<VkAttachmentDescription2> attachments;
Array<VkAttachmentReference2> inputRefs;
+3 -1
View File
@@ -2,13 +2,14 @@
#include "Graphics.h"
#include "Resources.h"
#include "Graphics/RenderTarget.h"
#include <vulkan/vulkan_core.h>
namespace Seele {
namespace Vulkan {
class RenderPass : public Gfx::RenderPass {
public:
RenderPass(PGraphics graphics, Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, std::string name,
RenderPass(PGraphics graphics, Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, URect renderArea, std::string name,
Array<uint32> viewMasks = {}, Array<uint32> correlationMasks = {});
virtual ~RenderPass();
uint32 getFramebufferHash();
@@ -17,6 +18,7 @@ class RenderPass : public Gfx::RenderPass {
constexpr size_t getClearValueCount() const { return clearValues.size(); }
constexpr VkClearValue* getClearValues() const { return clearValues.data(); }
constexpr VkSubpassContents getSubpassContents() const { return subpassContents; }
constexpr VkRect2D getRenderArea() const { return renderArea; }
constexpr const std::string& getName() const { return name; }
constexpr PRenderPassHandle getCommandHandle() const { return renderPass; }