Vulkan: Add support for CommandPool and CommandBuffer

Former-commit-id: 0ed1e8d09300577be3d4c52b94d6a8f594178a8b
This commit is contained in:
Lynix
2016-05-15 00:08:05 +02:00
parent e5528abb0f
commit bb945d773e
8 changed files with 275 additions and 1 deletions

View File

@@ -0,0 +1,53 @@
// 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_VKCOMMANDPOOL_HPP
#define NAZARA_VULKAN_VKCOMMANDPOOL_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/HandledObject.hpp>
#include <Nazara/Vulkan/VkDeviceObject.hpp>
namespace Nz
{
namespace Vk
{
class CommandBuffer;
class CommandPool;
using CommandPoolHandle = ObjectHandle<CommandPool>;
class CommandPool : public DeviceObject<CommandPool, VkCommandPool, VkCommandPoolCreateInfo>, public HandledObject<CommandPool>
{
friend DeviceObject;
public:
inline CommandPool(Device& instance);
CommandPool(const CommandPool&) = delete;
CommandPool(CommandPool&&) = default;
~CommandPool() = default;
CommandBuffer AllocateCommandBuffer(VkCommandBufferLevel level);
std::vector<CommandBuffer> AllocateCommandBuffers(UInt32 commandBufferCount, VkCommandBufferLevel level);
using DeviceObject::Create;
inline bool Create(UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
inline bool Reset(VkCommandPoolResetFlags flags);
CommandPool& operator=(const CommandPool&) = delete;
CommandPool& operator=(CommandPool&&) = delete;
private:
static VkResult CreateHelper(Device& device, const VkCommandPoolCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkCommandPool* handle);
static void DestroyHelper(Device& device, VkCommandPool handle, const VkAllocationCallbacks* allocator);
};
}
}
#include <Nazara/Vulkan/VkCommandPool.inl>
#endif // NAZARA_VULKAN_VKCOMMANDPOOL_HPP