#pragma once

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

////////////////////////////////////////////////////////////////////////////////////
//	Vulkan Buffer

#include "VulkanDevice.h"
#include <functional>

namespace Vulkan {

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

    Buffer& operator=(const Buffer& other) = delete;

    virtual void Initialize(Device*               device,
                            VkDeviceSize          size,
                            VkBufferUsageFlags    usage,
                            VkMemoryPropertyFlags properties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);

    Device*                m_owner;
    VkDeviceMemory         m_memory;
    VkDeviceSize           m_size;
    VkBuffer               m_buffer;
    VkBufferUsageFlags     m_usage;
    VkMemoryPropertyFlags  m_properties;

    virtual void Create();
    virtual void Destroy();
    virtual void Resize(size_t size);
    virtual void UploadData(size_t size, std::function<void(void*)> callback);
    virtual void UploadData(size_t size, const uint8_t* data);
    virtual void UploadDataUsingStagingBuffer(const uint8_t* data);
};

} // Vulkan namespace
