GPU Cleanup

This commit is contained in:
antopilo
2025-04-15 23:34:33 -04:00
parent 62fe4b360d
commit d2b9ef97da
6 changed files with 21 additions and 9 deletions

View File

@@ -67,7 +67,7 @@ namespace Nuake
m_Logs.push_back(newLog);
}
std::vector<LogEntry> Logger::GetLogs()
std::vector<LogEntry>& Logger::GetLogs()
{
return m_Logs;
}

View File

@@ -29,7 +29,7 @@ namespace Nuake
public:
static void Log(const std::string& log, const std::string& logger = "main", LOG_TYPE type = VERBOSE);
static std::vector<LogEntry> GetLogs();
static std::vector<LogEntry>& GetLogs();
static void ClearLogs();
static size_t GetLogCount() { return m_Logs.size(); }
};

View File

@@ -241,8 +241,8 @@ VulkanImage::VulkanImage(void* inData, ImageFormat inFormat, Vector2 inSize) : V
);
AddGPUCleanUpFunc([=]() {
//vkDestroyImageView(VkRenderer::Get().GetDevice(), ImageView, nullptr);
//vmaDestroyImage(VulkanAllocator::Get().GetAllocator(), Image, Allocation);
vkDestroyImageView(VkRenderer::Get().GetDevice(), ImageView, nullptr);
vmaDestroyImage(VulkanAllocator::Get().GetAllocator(), Image, Allocation);
});
}
@@ -318,14 +318,14 @@ VulkanImage::VulkanImage(void* inData, size_t inSize) :
});
AddGPUCleanUpFunc([=]() {
//vkDestroyImageView(VkRenderer::Get().GetDevice(), ImageView, nullptr);
//vmaDestroyImage(VulkanAllocator::Get().GetAllocator(), Image, Allocation);
vkDestroyImageView(VkRenderer::Get().GetDevice(), ImageView, nullptr);
vmaDestroyImage(VulkanAllocator::Get().GetAllocator(), Image, Allocation);
});
}
VulkanImage::~VulkanImage()
{
//Logger::Log("Deleting VulkanImage", "vulkan", VERBOSE);
Logger::Log("Deleting VulkanImage", "vulkan", VERBOSE);
GPUResources::Get().QueueDeletion(GetGPUCleanUpStack());
}

View File

@@ -36,7 +36,7 @@
#include <array>
#include <algorithm>
bool NKUseValidationLayer = true;
bool NKUseValidationLayer = false;
using namespace Nuake;

View File

@@ -23,6 +23,17 @@ namespace Nuake
}
}
LightComponent::~LightComponent()
{
for (int i = 0; i < CSM_AMOUNT; i++)
{
if (m_ShadowMaps[i])
{
GPUResources::Get().RemoveTexture(m_ShadowMaps[i]);
}
}
}
void LightComponent::SetCastShadows(bool toggle)
{
CastShadows = toggle;

View File

@@ -46,6 +46,7 @@ namespace Nuake
BindComponentField<&LightComponent::CastShadows>("CastShadows", "CastShadows");
}
public:
// All lights
int32_t Type = Point;
@@ -72,7 +73,7 @@ namespace Nuake
public:
LightComponent();
~LightComponent() = default;
~LightComponent();
std::vector<UUID> LightMapIDs = std::vector<UUID>();
void SetCastShadows(bool toggle);