#pragma once

/*
	VulkanFramework
	by John Ryland
	Copyright (c) 2023
*/

////////////////////////////////////////////////////////////////////////////////////
//	Vulkan Image Buffer

#include "VulkanDevice.h"
#include "VulkanCommandPool.h"

namespace Vulkan {

class ImageBuffer
{
public:
    ImageBuffer();
    virtual ~ImageBuffer();

    virtual void Initialize(Device*               device,
                            uint32_t              width,
                            uint32_t              height,
                            VkImageUsageFlags     usage,
                            VkImageAspectFlags    aspectMask  = VK_IMAGE_ASPECT_COLOR_BIT,
                            VkFormat              imageFormat = VK_FORMAT_R8G8B8A8_UNORM,
                            uint32_t              mipLevels   = 1,
                            VkSampleCountFlagBits samples     = VK_SAMPLE_COUNT_1_BIT);
    virtual void Destroy();

    Device*               m_owner;
    uint32_t              m_width;
    uint32_t              m_height;
    VkFormat              m_format;
    VkImage               m_image;
    VkDeviceMemory        m_memory;
    VkImageView           m_view;
    VkImageUsageFlags     m_usage;
    VkImageAspectFlags    m_aspectMask;
    VkSampleCountFlagBits m_samples;
    uint32_t              m_mipLevels;

protected:
    virtual void CreateImage();
    virtual void CreateMipmaps();
    virtual void CreateView();
};

} // Vulkan namespace
