diff --git a/Engine/CMakeLists.txt b/Engine/CMakeLists.txt index 7086521..f12b616 100644 --- a/Engine/CMakeLists.txt +++ b/Engine/CMakeLists.txt @@ -11,7 +11,7 @@ target_include_directories(FyrionEngine PRIVATE ThirdParty/concurrentqueue) target_include_directories(FyrionEngine PRIVATE ThirdParty/dxc/include) target_compile_definitions(FyrionEngine PUBLIC FMT_LIB_EXPORT=1) -target_link_libraries(FyrionEngine PRIVATE mimalloc glfw vma volk vulkan-sdk freetype nfd SPIRV-Cross SPIRV-Reflect) +target_link_libraries(FyrionEngine PRIVATE mimalloc glfw vma volk vulkan-sdk freetype nfd SPIRV-Reflect) add_binary_file(FyrionEngine ThirdParty/dxc dxcompiler) diff --git a/Engine/Source/Fyrion/Core/Registry.cpp b/Engine/Source/Fyrion/Core/Registry.cpp index 4cfc88f..3e97b06 100644 --- a/Engine/Source/Fyrion/Core/Registry.cpp +++ b/Engine/Source/Fyrion/Core/Registry.cpp @@ -264,6 +264,14 @@ namespace Fyrion } } + void TypeHandler::Release(VoidPtr instance) const + { + if (m_fnRelease) + { + m_fnRelease(this, instance); + } + } + void TypeHandler::Destructor(VoidPtr instance) const { if (m_fnDestructor) @@ -432,6 +440,11 @@ namespace Fyrion m_typeHandler.m_fnDestructor = destructor; } + void TypeBuilder::SetFnRelease(TypeHandler::FnRelease fnRelease) + { + m_typeHandler.m_fnRelease = fnRelease; + } + void TypeBuilder::SetFnMove(TypeHandler::FnMove fnMove) { m_typeHandler.m_fnMove = fnMove; diff --git a/Engine/Source/Fyrion/Core/Registry.hpp b/Engine/Source/Fyrion/Core/Registry.hpp index d1fe156..e26e940 100644 --- a/Engine/Source/Fyrion/Core/Registry.hpp +++ b/Engine/Source/Fyrion/Core/Registry.hpp @@ -22,6 +22,16 @@ namespace Fyrion typedef VoidPtr (*FnCast)(const TypeHandler* typeHandler, VoidPtr derived); + + template + struct ReleaseHandler + { + static void Release(T& value) + { + } + }; + + struct FunctionInfo { TypeID functionId{}; @@ -236,10 +246,9 @@ namespace Fyrion typedef void (*FnDestructor)(const TypeHandler* typeHandler, VoidPtr instance); typedef void (*FnCopy)(const TypeHandler* typeHandler, ConstPtr source, VoidPtr dest); typedef void (*FnMove)(const TypeHandler* typeHandler, VoidPtr source, VoidPtr dest); - + typedef void (*FnRelease)(const TypeHandler* typeHandler, VoidPtr instance); friend class TypeBuilder; private: - String m_name{}; String m_simpleName{}; TypeInfo m_typeInfo{}; @@ -248,6 +257,7 @@ namespace Fyrion FnCopy m_fnCopy{}; FnDestructor m_fnDestructor{}; FnMove m_fnMove{}; + FnRelease m_fnRelease{}; HashMap> m_constructors{}; Array m_constructorArray{}; @@ -280,11 +290,12 @@ namespace Fyrion const TypeInfo& GetTypeInfo() const; u32 GetVersion() const; - void Destroy(VoidPtr instance, Allocator& allocator = MemoryGlobals::GetDefaultAllocator()) const; - void Destructor(VoidPtr instance) const; - void Copy(ConstPtr source, VoidPtr dest) const; - void Move(VoidPtr source, VoidPtr dest) const; - VoidPtr Cast(TypeID typeId, VoidPtr instance) const; + void Destroy(VoidPtr instance, Allocator& allocator = MemoryGlobals::GetDefaultAllocator()) const; + void Release(VoidPtr instance) const; + void Destructor(VoidPtr instance) const; + void Copy(ConstPtr source, VoidPtr dest) const; + void Move(VoidPtr source, VoidPtr dest) const; + VoidPtr Cast(TypeID typeId, VoidPtr instance) const; VoidPtr NewInstance(Allocator& allocator = MemoryGlobals::GetDefaultAllocator()) const { @@ -392,15 +403,15 @@ namespace Fyrion public: TypeBuilder(TypeHandler& typeHandler); - void SetFnDestroy(TypeHandler::FnDestroy fnDestroy); - void SetFnCopy(TypeHandler::FnCopy fnCopy); - void SetFnDestructor(TypeHandler::FnDestructor destructor); - void SetFnMove(TypeHandler::FnMove fnMove); - - ConstructorBuilder NewConstructor(TypeID* ids, FieldInfo* params, usize size); - FieldBuilder NewField(const StringView& fieldName); - FunctionBuilder NewFunction(const FunctionHandlerCreation& creation); - void AddBaseType(TypeID typeId, FnCast fnCast); + void SetFnDestroy(TypeHandler::FnDestroy fnDestroy); + void SetFnCopy(TypeHandler::FnCopy fnCopy); + void SetFnDestructor(TypeHandler::FnDestructor destructor); + void SetFnMove(TypeHandler::FnMove fnMove); + void SetFnRelease(TypeHandler::FnRelease fnRelease); + ConstructorBuilder NewConstructor(TypeID* ids, FieldInfo* params, usize size); + FieldBuilder NewField(const StringView& fieldName); + FunctionBuilder NewFunction(const FunctionHandlerCreation& creation); + void AddBaseType(TypeID typeId, FnCast fnCast); TypeHandler& GetTypeHandler() const; @@ -815,6 +826,7 @@ namespace Fyrion static void CopyImpl(const TypeHandler* typeHandler, ConstPtr source, VoidPtr dest) {}; static void DestructorImpl(const TypeHandler* typeHandler, VoidPtr instance){}; static void MoveImpl(const TypeHandler* typeHandler, VoidPtr origin, VoidPtr destination) {}; + static void ReleaseImpl(const TypeHandler* typeHandler, VoidPtr instance) {}; }; template @@ -860,6 +872,11 @@ namespace Fyrion FY_ASSERT(false, "type is not move or copy constructible"); } } + + static void ReleaseImpl(const TypeHandler* typeHandler, VoidPtr instance) + { + ReleaseHandler::Release(*static_cast(instance)); + } }; @@ -879,6 +896,7 @@ namespace Fyrion typeBuilder.SetFnCopy(&NativeTypeHandlerFuncs::CopyImpl); typeBuilder.SetFnDestructor(&NativeTypeHandlerFuncs::DestructorImpl); typeBuilder.SetFnMove(&NativeTypeHandlerFuncs::MoveImpl); + typeBuilder.SetFnRelease(&NativeTypeHandlerFuncs::ReleaseImpl); } auto Constructor() diff --git a/Engine/Source/Fyrion/Graphics/RenderGraph.cpp b/Engine/Source/Fyrion/Graphics/RenderGraph.cpp deleted file mode 100644 index c538d3a..0000000 --- a/Engine/Source/Fyrion/Graphics/RenderGraph.cpp +++ /dev/null @@ -1,468 +0,0 @@ -#include "RenderGraph.hpp" - -#include "Graphics.hpp" -#include "Fyrion/Core/Graph.hpp" -#include "Fyrion/Core/Logger.hpp" -#include "Fyrion/Core/Registry.hpp" -#include "Fyrion/Core/StringUtils.hpp" -#include "Fyrion/Resource/Repository.hpp" - -namespace Fyrion -{ - - namespace - { - Logger& logger = Logger::GetLogger("Fyrion::RenderGraph"); - - u32 counter{}; - HashMap> renderGraphs{}; - HashMap passes{}; - } - - Texture RenderGraphNode::GetNodeInputTexture(const StringView& inputName) - { - auto it = m_inputs.Find(inputName); - if (it != m_inputs.end()) - { - return it->second.resource->texture; - } - return {nullptr}; - } - - RenderPass RenderGraphNode::GetRenderPass() - { - return m_renderPass; - } - - Extent3D RenderGraphNode::GetRenderPassExtent() - { - return m_extent; - } - - Buffer RenderGraphNode::GetOutputBuffer(const StringView& outputName) - { - auto it = m_outputs.Find(outputName); - if (it != m_outputs.end()) - { - return it->second->buffer; - } - return {}; - } - - Buffer RenderGraphNode::GetInputBuffer(const StringView& outputName) - { - auto it = m_inputs.Find(outputName); - if (it != m_inputs.end()) - { - return it->second.resource->buffer; - } - return {}; - } - - void RenderGraphNode::SetOutputBuffer(const StringView& outputName, const Buffer& buffer) - { - FY_ASSERT(false, "Not implemented"); - } - - void RenderGraphNode::SetOutputReference(const StringView& outputName, VoidPtr reference) - { - if (const auto it = m_outputs.Find(outputName)) - { - it->second->reference = reference; - } - } - - VoidPtr RenderGraphNode::GetInputReference(const StringView& inputName) - { - if (auto it = m_inputs.Find(inputName)) - { - return it->second.resource->reference; - } - return nullptr; - } - - RenderGraphNode::RenderGraphNode(const String& name) : m_name(name) - { - } - - void RenderGraphNode::CreateRenderPass() - { - if (m_creation.type == RenderGraphPassType::Graphics) - { - m_clearValues.Clear(); - Array attachments{}; - - for(const auto& output: m_creation.outputs) - { - if (output.type == RenderGraphResourceType::Attachment) - { - auto& resource = m_outputs[output.name]; - - AttachmentCreation attachmentCreation = AttachmentCreation{ - .texture = resource->texture, - .loadOp = output.loadOp - }; - - switch (output.loadOp) - { - case LoadOp::Load: - { - attachmentCreation.initialLayout = resource->creation.format != Format::Depth ? ResourceLayout::ColorAttachment : ResourceLayout::DepthStencilAttachment; - attachmentCreation.finalLayout = resource->creation.format != Format::Depth ? ResourceLayout::ColorAttachment : ResourceLayout::DepthStencilAttachment; - break; - } - case LoadOp::DontCare: - case LoadOp::Clear: - { - attachmentCreation.initialLayout = ResourceLayout::Undefined; - attachmentCreation.finalLayout = resource->creation.format != Format::Depth ? ResourceLayout::ColorAttachment : ResourceLayout::DepthStencilAttachment; - break; - } - } - - attachments.EmplaceBack(attachmentCreation); - m_extent = resource->extent; - - if (output.loadOp == LoadOp::Clear) - { - m_clearValues.EmplaceBack(output.cleanValue); - } - } - } - - // Color color = Color::FromU32(Hash32(node.m_name.CStr())); - // node.m_debugColor = Vec3{color.FloatRed(), color.FloatGreen(), color.FloatBlue()}; - - RenderPassCreation renderPassCreation{ - .attachments = attachments - }; - - m_renderPass = Graphics::CreateRenderPass(renderPassCreation); - } - } - - Extent RenderGraph::GetViewportExtent() - { - return m_viewportSize; - } - - void RenderGraph::Resize(Extent viewportSize) - { - } - - void RenderGraph::RecordCommands(RenderCommands& renderCommands, f64 deltaTime) - { - for(auto& node: m_nodes) - { - node->m_renderGraphPass->Update(deltaTime); - - renderCommands.BeginLabel(node->m_name, {0, 0, 0, 1}); - -// GPUDevice::BeginLabel(cmd, node.m_name, {node.m_debugColor.x, -// node.m_debugColor.y, -// node.m_debugColor.z, -// 1}); - for(const auto& inputIt: node->m_inputs) - { - if (inputIt.second.creation.type == RenderGraphResourceType::Texture) - { - ResourceBarrierInfo resourceBarrierInfo{}; - resourceBarrierInfo.texture = inputIt.second.resource->texture; - resourceBarrierInfo.oldLayout = inputIt.second.resource->creation.format != Format::Depth ? ResourceLayout::ColorAttachment : ResourceLayout::DepthStencilAttachment; - resourceBarrierInfo.newLayout = ResourceLayout::ShaderReadOnly; - resourceBarrierInfo.isDepth = inputIt.second.resource->creation.format == Format::Depth; - renderCommands.ResourceBarrier(resourceBarrierInfo); - } - } - - if (node->m_renderPass) - { - BeginRenderPassInfo renderPassInfo{}; - renderPassInfo.renderPass = node->m_renderPass; - renderPassInfo.clearValues = node->m_clearValues; - renderCommands.BeginRenderPass(renderPassInfo); - - ViewportInfo viewportInfo{}; - viewportInfo.x = 0.; - viewportInfo.y = 0.; - viewportInfo.y = (f32) node->m_extent.height; - viewportInfo.width = (f32)node->m_extent.width; - viewportInfo.height = -(f32)node->m_extent.height; - viewportInfo.minDepth = 0.; - viewportInfo.maxDepth = 1.; - - renderCommands.SetViewport(viewportInfo); - - auto scissor = Rect{0, 0, node->m_extent.width, node->m_extent.height}; - renderCommands.SetScissor(scissor); - } - - if (node->m_renderGraphPass) - { - node->m_renderGraphPass->Render(renderCommands); - } - - if (node->m_renderPass) - { - renderCommands.EndRenderPass(); - } - - renderCommands.EndLabel(); - } - } - - void RenderGraph::Destroy() - { - //GPUDevice::WaitGPU(); - - for (auto& node: m_nodes) - { - - if (node->m_renderGraphPass) - { - node->m_renderGraphPass->Destroy(); - auto typeHandler = Registry::FindTypeById(node->m_renderPassTypeId); - FY_ASSERT(typeHandler, "type not found"); - typeHandler->Destroy(node->m_renderGraphPass); - } - - if (node->m_renderPass) - { - Graphics::DestroyRenderPass(node->m_renderPass); - } - } - - for(auto& resource : m_resources) - { - DestroyResource(*resource.second); - } - - renderGraphs.Erase(renderGraphs.Find(m_id)); - - MemoryGlobals::GetDefaultAllocator().DestroyAndFree(this); - } - - RenderGraph* RenderGraph::Create(const Extent& viewportSize, RID renderGraphId) - { - u32 id = counter++; - SharedPtr renderGraph = MakeShared(id, viewportSize); - renderGraphs.Insert(Pair>(id, renderGraph)); - - ResourceObject asset = Repository::Read(renderGraphId); - FY_ASSERT(asset, "Render Graph Asset not found"); - - Graph> graph{}; - - HashMap> edges{}; - - Span assetPasses = asset[RenderGraphAsset::Passes].As>(); - Span assetEdges = asset[RenderGraphAsset::Passes].As>(); - - for(const auto& pass: assetPasses) - { - graph.AddNode(pass, MakeShared(pass)); - } - - //origin become dest. - for (const auto& edge: assetEdges) - { - auto destNode = WithoutLast(edge.dest, "::"); - auto destEdge = Last(edge.dest, "::"); - auto withoutLast = WithoutLast(edge.origin, "::"); - graph.AddEdge(destNode, withoutLast); - logger.Debug("added graph edge {} {}", destNode, withoutLast); - - auto it = edges.Find(destNode); - if (it == edges.end()) - { - it = edges.Insert(destNode, HashMap()).first; - } - it->second.Insert(MakePair(String{destEdge}, String{edge.origin})); - logger.Debug("added edge {} {} {}", destNode, destEdge, edge.origin); - } - - renderGraph->m_nodes = graph.Sort(); - for (auto& node: renderGraph->m_nodes) - { - logger.Debug("sort: node {} ", node->m_name); - } - - for (auto& node: renderGraph->m_nodes) - { - HashMap& nodeEdges = edges[node->m_name]; - - auto dbIt = passes.Find(node->m_name); - FY_ASSERT(dbIt != passes.end(), "node not found"); - node->m_creation = dbIt->second; - - //dest = input - for(auto& input: node->m_creation.inputs) - { - auto it = nodeEdges.Find(input.name); - if (it != nodeEdges.end()) - { - auto itRes = renderGraph->m_resources.Find(it->second); - FY_ASSERT(itRes != renderGraph->m_resources.end(), "resource not found"); - FY_ASSERT(itRes->second->creation.format == input.format, "different formats"); - node->m_inputs.Insert(MakePair(input.name, InputNodeResource{input, itRes->second})); - logger.Debug("added input {}, {} ", node->m_name, input.name); - } - } - - //origin = output - for(const auto& output: node->m_creation.outputs) - { - String resourceName = node->m_name + "::" + output.name; - auto inputIt = node->m_inputs.Find(output.name); - if (inputIt != node->m_inputs.end()) - { - node->m_outputs.Insert(MakePair(String{output.name}, inputIt->second.resource)); - renderGraph->m_resources.Insert(MakePair(resourceName, inputIt->second.resource)); - } - else - { - auto resource = MakeShared(); - renderGraph->CreateResource(output, *renderGraph->m_resources.Insert(MakePair(resourceName, resource)).first->second); - node->m_outputs.Insert(MakePair(String{output.name}, resource)); - logger.Debug("Created resource {} ", resourceName); - } - } - - node->CreateRenderPass(); - - logger.Debug("creating node {} ", node->m_name); - - TypeHandler* typeHandler = Registry::FindTypeByName(node->m_name); - if (typeHandler) - { - for (TypeID baseType : typeHandler->GetBaseTypes()) - { - if (baseType == GetTypeID()) - { - RenderGraphPass* renderGraphPass = typeHandler->Cast(typeHandler->NewInstance()); - renderGraphPass->node = node.Get(); - node->m_renderGraphPass = renderGraphPass; - node->m_renderPassTypeId = typeHandler->GetTypeInfo().typeId; - } - } - } - - if (node->m_renderGraphPass) - { - node->m_renderGraphPass->Init(); - } - } - - return renderGraph.Get(); - } - - void RenderGraph::RegisterPass(const RenderGraphPassCreation& renderGraphPassCreation) - { - logger.Debug("{} Registered", renderGraphPassCreation.name); - passes.Emplace(renderGraphPassCreation.name, RenderGraphPassCreation{renderGraphPassCreation}); - } - - Texture RenderGraph::GetColorOutput() const - { - return {}; - } - - Texture RenderGraph::GetDepthOutput() const - { - return {}; - } - - RenderGraph::RenderGraph(u32 id, const Extent& viewportSize) : m_id(id), m_viewportSize(viewportSize) - { - } - - void RenderGraph::CreateResource(const RenderGraphResourceCreation& renderGraphResourceCreation, RenderGraphResource& renderGraphResource) const - { - renderGraphResource.creation = renderGraphResourceCreation; - - switch (renderGraphResourceCreation.type) - { - case RenderGraphResourceType::Buffer: - { - if (renderGraphResourceCreation.bufferInitialSize > 0) - { - renderGraphResource.buffer = Graphics::CreateBuffer(BufferCreation{ - .usage = renderGraphResourceCreation.bufferUsage, - .size = renderGraphResourceCreation.bufferInitialSize, - .allocation = renderGraphResourceCreation.bufferAllocation - }); - renderGraphResource.ownResource = true; - renderGraphResource.destroyed = false; - } - break; - } - case RenderGraphResourceType::Texture: - case RenderGraphResourceType::Attachment: - { - TextureCreation textureCreation{}; - if (renderGraphResourceCreation.size > 0) - { - textureCreation.extent = renderGraphResourceCreation.size; - } - else if (renderGraphResourceCreation.scale > 0.f) - { - Extent size = Extent{m_viewportSize.width, m_viewportSize.height} * renderGraphResourceCreation.scale; - textureCreation.extent = {(size.width), (size.width), 1}; - } - else - { - FY_ASSERT(false, "texture without size"); - } - - renderGraphResource.extent = textureCreation.extent; - - textureCreation.format = renderGraphResourceCreation.format; - if (textureCreation.format != Format::Depth) - { - textureCreation.usage = TextureUsage::RenderPass | TextureUsage::ShaderResource; - } - else - { - textureCreation.usage = TextureUsage::DepthStencil | TextureUsage::ShaderResource; - } - - renderGraphResource.texture = Graphics::CreateTexture(textureCreation); - renderGraphResource.ownResource = true; - renderGraphResource.destroyed = false; - - break; - } - case RenderGraphResourceType::Reference: - { - break; - } - } - } - - void RenderGraph::DestroyResource(RenderGraphResource& renderGraphResource) - { - if (renderGraphResource.destroyed) return; - if (!renderGraphResource.ownResource) return; - - renderGraphResource.destroyed = true; - - switch (renderGraphResource.creation.type) - { - case RenderGraphResourceType::Buffer: - { - Graphics::DestroyBuffer(renderGraphResource.buffer); - break; - } - case RenderGraphResourceType::Texture: - case RenderGraphResourceType::Attachment: - { - Graphics::DestroyTexture(renderGraphResource.texture); - break; - } - case RenderGraphResourceType::Reference: - { - break; - } - } - } -} diff --git a/Engine/Source/Fyrion/Graphics/RenderGraph.hpp b/Engine/Source/Fyrion/Graphics/RenderGraph.hpp deleted file mode 100644 index 2494988..0000000 --- a/Engine/Source/Fyrion/Graphics/RenderGraph.hpp +++ /dev/null @@ -1,161 +0,0 @@ -#pragma once - -#include "GraphicsTypes.hpp" -#include "Fyrion/Core/String.hpp" -#include "Fyrion/Core/HashMap.hpp" -#include "Fyrion/Core/Math.hpp" -#include "Fyrion/Core/SharedPtr.hpp" - - -namespace Fyrion -{ - struct RenderGraphPass; - - struct RenderGraphEdge - { - String origin{}; - String dest{}; - }; - - struct RenderGraphAsset - { - constexpr static u32 Passes = 0; - constexpr static u32 Edges = 1; - constexpr static u32 ColorOutput = 2; - constexpr static u32 DepthOutput = 3; - }; - - class RenderGraph; - - enum class RenderGraphResourceType - { - Buffer = 0, - Texture = 1, - Attachment = 2, - Reference = 3, - }; - - enum class RenderGraphPassType - { - Other = 0, - Graphics = 1, - Compute = 2 - }; - - struct RenderGraphResourceCreation - { - String name{}; - RenderGraphResourceType type{}; - Extent3D size{}; - Vec2 scale{}; - LoadOp loadOp{LoadOp::Clear}; - Vec4 cleanValue{}; - Format format{}; - BufferUsage bufferUsage{}; - BufferAllocation bufferAllocation{BufferAllocation::GPUOnly}; - usize bufferInitialSize{}; - }; - - struct RenderGraphPassCreation - { - String name{}; - Array inputs{}; - Array outputs{}; - RenderGraphPassType type{}; - }; - - struct RenderGraphResource - { - RenderGraphResourceCreation creation{}; - Texture texture{}; - Extent3D extent{}; - Buffer buffer{}; - VoidPtr reference{}; - bool destroyed{}; - bool ownResource{}; - }; - - struct InputNodeResource - { - RenderGraphResourceCreation creation{}; - SharedPtr resource{}; - }; - - - class FY_API RenderGraphNode - { - public: - Texture GetNodeInputTexture(const StringView& inputName); - RenderPass GetRenderPass(); - Extent3D GetRenderPassExtent(); - Buffer GetOutputBuffer(const StringView& outputName); - Buffer GetInputBuffer(const StringView& outputName); - void SetOutputBuffer(const StringView& outputName, const Buffer& buffer); - void SetOutputReference(const StringView& outputName, VoidPtr reference); - VoidPtr GetInputReference(const StringView& inputName); - explicit RenderGraphNode(const String& name); - - - template - Type& GetInputReference(const StringView& inputName) - { - return *static_cast(GetInputReference(inputName)); - } - - private: - String m_name{}; - RenderGraphPassCreation m_creation{}; - RenderPass m_renderPass{}; - RenderGraphPass* m_renderGraphPass{}; - TypeID m_renderGraphPassId{}; - HashMap m_inputs{}; - HashMap> m_outputs{}; - TypeID m_renderPassTypeId{}; - Extent3D m_extent{}; - Array m_clearValues{}; - Vec3 m_debugColor{}; - - void CreateRenderPass(); - - friend class RenderGraph; - }; - - struct RenderGraphPass - { - RenderGraphNode* node = nullptr; - - virtual void Init() {} - virtual void Update(f64 deltaTime) {} - virtual void Render(const RenderCommands& cmd) {} - virtual void Destroy() {} - virtual void Resize(Extent newExtent) {} - virtual ~RenderGraphPass() = default; - }; - - using RenderGraphResMap = HashMap>; - - - class FY_API RenderGraph - { - public: - RenderGraph(u32 id, const Extent& viewportSize); - - Extent GetViewportExtent(); - void Resize(Extent viewportSize); - void RecordCommands(RenderCommands& renderCommands, f64 deltaTime); - Texture GetColorOutput() const; - Texture GetDepthOutput() const; - void Destroy(); - - static RenderGraph* Create(const Extent& viewportSize, RID renderGraphId); - static void RegisterPass(const RenderGraphPassCreation& renderGraphPassCreation); - private: - u32 m_id{}; - Extent m_viewportSize{}; - Array> m_nodes{}; - RenderGraphResMap m_resources{}; - - void CreateResource(const RenderGraphResourceCreation& renderGraphResourceCreation, RenderGraphResource& renderGraphResource) const; - static void DestroyResource(RenderGraphResource& renderGraphResource); - }; -} diff --git a/Engine/Test/Fyrion/Core/ReflectionTest.cpp b/Engine/Test/Fyrion/Core/ReflectionTest.cpp index f24c538..79fe772 100644 --- a/Engine/Test/Fyrion/Core/ReflectionTest.cpp +++ b/Engine/Test/Fyrion/Core/ReflectionTest.cpp @@ -5,7 +5,18 @@ using namespace Fyrion; -namespace +namespace ReflectionTest +{ + class ReflectionTestClass; +} + +template<> +struct Fyrion::ReleaseHandler +{ + static void Release(ReflectionTest::ReflectionTestClass&); +}; + +namespace ReflectionTest { struct IncompleteType; @@ -35,6 +46,8 @@ namespace static i32 constructorCalls; static i32 destructorCalls; + i32 releaseCount = 0; + ReflectionTestClass() : m_int(10), m_string("Empty") { constructorCalls++; @@ -183,6 +196,8 @@ namespace CHECK(test.GetInt() == 123); CHECK(test.GetString() == "TestStr"); + testClass->Release(instance); + CHECK(test.releaseCount == 1); testClass->Destroy(instance); CHECK(ReflectionTestClass::destructorCalls == 1); @@ -198,6 +213,8 @@ namespace CHECK(test.GetInt() == 10); CHECK(test.GetString() == "Empty"); + testClass->Release(instance); + CHECK(test.releaseCount == 1); testClass->Destroy(instance); CHECK(ReflectionTestClass::destructorCalls == 1); ReflectionTestClass::ResetCount(); @@ -404,4 +421,11 @@ namespace // runtimeType.Field("Value", GetTypeID()); } -} \ No newline at end of file +} + + +void ReleaseHandler::Release(ReflectionTest::ReflectionTestClass& value) +{ + value.releaseCount++; +} + diff --git a/Engine/ThirdParty/CMakeLists.txt b/Engine/ThirdParty/CMakeLists.txt index db63c3b..dd9b0aa 100644 --- a/Engine/ThirdParty/CMakeLists.txt +++ b/Engine/ThirdParty/CMakeLists.txt @@ -2,7 +2,7 @@ add_subdirectory(freetype) add_subdirectory(glfw) add_subdirectory(mimalloc) add_subdirectory(nativefiledialog-extended) -add_subdirectory(SPIRV-Cross) +#add_subdirectory(SPIRV-Cross) add_subdirectory(SPIRV-Reflect) add_subdirectory(vma) add_subdirectory(volk)