diff --git a/include/Nazara/Vulkan.hpp b/include/Nazara/Vulkan.hpp index eb8973dbe..dc72ba4c5 100644 --- a/include/Nazara/Vulkan.hpp +++ b/include/Nazara/Vulkan.hpp @@ -1,4 +1,4 @@ -// This file was automatically generated on 06 Jul 2016 at 14:00:09 +// This file was automatically generated on 12 Jul 2016 at 17:44:44 /* Nazara Engine - Vulkan @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/include/Nazara/Vulkan/VkBuffer.hpp b/include/Nazara/Vulkan/VkBuffer.hpp new file mode 100644 index 000000000..cf1399de4 --- /dev/null +++ b/include/Nazara/Vulkan/VkBuffer.hpp @@ -0,0 +1,41 @@ +// Copyright (C) 2016 Jérôme Leclercq +// This file is part of the "Nazara Engine - Vulkan" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#pragma once + +#ifndef NAZARA_VULKAN_VKBUFFER_HPP +#define NAZARA_VULKAN_VKBUFFER_HPP + +#include +#include + +namespace Nz +{ + namespace Vk + { + class Buffer : public DeviceObject + { + friend DeviceObject; + + public: + Buffer() = default; + Buffer(const Buffer&) = delete; + Buffer(Buffer&&) = default; + ~Buffer() = default; + + VkMemoryRequirements GetMemoryRequirements() const; + + Buffer& operator=(const Buffer&) = delete; + Buffer& operator=(Buffer&&) = delete; + + private: + static inline VkResult CreateHelper(const DeviceHandle& device, const VkBufferCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkBuffer* handle); + static inline void DestroyHelper(const DeviceHandle& device, VkBuffer handle, const VkAllocationCallbacks* allocator); + }; + } +} + +#include + +#endif // NAZARA_VULKAN_VKBUFFER_HPP diff --git a/include/Nazara/Vulkan/VkBuffer.inl b/include/Nazara/Vulkan/VkBuffer.inl new file mode 100644 index 000000000..b2f0f07d4 --- /dev/null +++ b/include/Nazara/Vulkan/VkBuffer.inl @@ -0,0 +1,34 @@ +// Copyright (C) 2016 Jérôme Leclercq +// This file is part of the "Nazara Engine - Vulkan" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#include +#include + +namespace Nz +{ + namespace Vk + { + inline VkMemoryRequirements Buffer::GetMemoryRequirements() const + { + NazaraAssert(IsValid(), "Invalid buffer"); + + VkMemoryRequirements memoryRequirements; + m_device->vkGetBufferMemoryRequirements(*m_device, m_handle, &memoryRequirements); + + return memoryRequirements; + } + + inline VkResult Buffer::CreateHelper(const DeviceHandle& device, const VkBufferCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkBuffer* handle) + { + return device->vkCreateBuffer(*device, createInfo, allocator, handle); + } + + inline void Buffer::DestroyHelper(const DeviceHandle& device, VkBuffer handle, const VkAllocationCallbacks* allocator) + { + return device->vkDestroyBuffer(*device, handle, allocator); + } + } +} + +#include