Merge branch 'better_vk_commands' into indev

This commit is contained in:
2024-01-03 15:47:31 +01:00
committed by GitHub
12 changed files with 763 additions and 27 deletions

View File

@@ -138,6 +138,16 @@ namespace mlx
void Image::create(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, const char* name, bool dedicated_memory)
{
CmdResource::setDestroyer([this]()
{
this->destroySampler();
this->destroyImageView();
if(_image != VK_NULL_HANDLE)
Render_Core::get().getAllocator().destroyImage(_allocation, _image);
_image = VK_NULL_HANDLE;
});
_width = width;
_height = height;
_format = format;
@@ -332,12 +342,7 @@ namespace mlx
void Image::destroy() noexcept
{
destroySampler();
destroyImageView();
if(_image != VK_NULL_HANDLE)
Render_Core::get().getAllocator().destroyImage(_allocation, _image);
_image = VK_NULL_HANDLE;
CmdResource::requireDestroy();
}
uint32_t formatSize(VkFormat format)