Vulkan: Add VkBuffer wrapper
Former-commit-id: 1038adae4a7ca619f0953cb305d14345b197f056 [formerly f03490e99245cb167e95057e80422908654d6644] Former-commit-id: aa5cf8a3d91db8a109504e542f255120a319d70b
This commit is contained in:
parent
90826e4467
commit
80404cf320
|
|
@ -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 <Nazara/Vulkan/Config.hpp>
|
||||
#include <Nazara/Vulkan/RenderTarget.hpp>
|
||||
#include <Nazara/Vulkan/RenderWindow.hpp>
|
||||
#include <Nazara/Vulkan/VkBuffer.hpp>
|
||||
#include <Nazara/Vulkan/VkCommandBuffer.hpp>
|
||||
#include <Nazara/Vulkan/VkCommandPool.hpp>
|
||||
#include <Nazara/Vulkan/VkDevice.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 <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Vulkan/VkDeviceObject.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
namespace Vk
|
||||
{
|
||||
class Buffer : public DeviceObject<Buffer, VkBuffer, VkBufferCreateInfo>
|
||||
{
|
||||
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 <Nazara/Vulkan/VkBuffer.inl>
|
||||
|
||||
#endif // NAZARA_VULKAN_VKBUFFER_HPP
|
||||
|
|
@ -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 <Nazara/Vulkan/VkBuffer.hpp>
|
||||
#include <Nazara/Vulkan/Debug.hpp>
|
||||
|
||||
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 <Nazara/Vulkan/DebugOff.hpp>
|
||||
Loading…
Reference in New Issue