Files
OpenVulkano/openVulkanoCpp/Vulkan/Resources/UniformBuffer.hpp
2025-01-06 16:28:27 +01:00

39 lines
1002 B
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "Vulkan/Resources/ManagedBuffer.hpp"
#include "Vulkan/Scene/IRecordable.hpp"
namespace OpenVulkano::Vulkan
{
class ManagedBuffer;
class UniformBuffer final : public IRecordable
{
ManagedBuffer::Ptr m_buffer = nullptr;
vk::DescriptorSet m_descriptorSet;
uint32_t m_frameOffset;
uint32_t m_setOffset, m_setCount = 1;
bool m_dynamic;
public:
~UniformBuffer() override
{
if (m_buffer) Close();
}
void Init(ManagedBuffer::Ptr buffer, uint32_t frameOffset, uint32_t frameSize, vk::DescriptorSetLayout* descriptorSetLayout, const DescriptorSetLayoutBinding& binding, uint32_t setId);
virtual void Close();
void Record(VulkanDrawContext* drawContext) override;
void Update(const void* data, uint32_t size, uint32_t bufferId) const;
};
}