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
#include <Nazara/Vulkan/VkCommandPool.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Vulkan/VkDevice.hpp>
#include <Nazara/Vulkan/Debug.hpp>
namespace Nz
{
namespace Vk
{
inline CommandPool::CommandPool(Device& device) :
DeviceObject(device)
{
}
inline bool CommandPool::Create(UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags, const VkAllocationCallbacks* allocator)
{
VkCommandPoolCreateInfo createInfo =
{
VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
nullptr,
flags,
queueFamilyIndex
};
return Create(createInfo, allocator);
}
inline bool CommandPool::Reset(VkCommandPoolResetFlags flags)
{
m_lastErrorCode = m_device.vkResetCommandPool(m_device, m_handle, flags);
if (m_lastErrorCode != VkResult::VK_SUCCESS)
return false;
return true;
}
VkResult CommandPool::CreateHelper(Device& device, const VkCommandPoolCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkCommandPool* handle)
{
return device.vkCreateCommandPool(device, createInfo, allocator, handle);
}
void CommandPool::DestroyHelper(Device& device, VkCommandPool handle, const VkAllocationCallbacks* allocator)
{
return device.vkDestroyCommandPool(device, handle, allocator);
}
}
}
#include <Nazara/Vulkan/DebugOff.hpp>