Refactor asset handling

This commit is contained in:
Thraix
2024-10-01 19:48:21 +02:00
parent b256b90abb
commit 9133bce7fc
22 changed files with 196 additions and 125 deletions
@@ -18,9 +18,9 @@ namespace Copium
VkRenderPass renderPass;
if (metaFileClass.HasValue("framebuffer-uuid"))
{
Framebuffer& fb = AssetManager::LoadAsset<Framebuffer>(Uuid{metaFileClass.GetValue("framebuffer-uuid")});
framebuffer = AssetRef<Framebuffer>(Uuid{metaFileClass.GetValue("framebuffer-uuid")});
Framebuffer& fb = framebuffer.GetAsset();
renderPass = fb.GetRenderPass();
framebuffer = fb;
}
else
{
@@ -62,10 +62,6 @@ namespace Copium
{
vkDestroyDescriptorSetLayout(Vulkan::GetDevice(), descriptorSetLayout, nullptr);
}
if (framebuffer != NULL_ASSET_HANDLE)
{
AssetManager::UnloadAsset(framebuffer);
}
}
void Pipeline::Bind(const CommandBuffer& commandBuffer)
+3 -1
View File
@@ -1,7 +1,9 @@
#pragma once
#include "copium/asset/Asset.h"
#include "copium/asset/AssetRef.h"
#include "copium/buffer/CommandBuffer.h"
#include "copium/buffer/Framebuffer.h"
#include "copium/pipeline/DescriptorSet.h"
#include "copium/pipeline/PipelineCreator.h"
#include "copium/util/Common.h"
@@ -20,7 +22,7 @@ namespace Copium
std::vector<VkDescriptorSet> boundDescriptorSets;
VkPipelineLayout pipelineLayout;
VkPipeline graphicsPipeline;
AssetHandle framebuffer;
AssetRef<Framebuffer> framebuffer;
public: