Add new Renderer architecture (far from complete)
Former-commit-id: 52226793d7a087dfe0523315d3303934daffee49 [formerly 9de1c04df6b371f861a2eee8bba38902ee5041cd] [formerly ecd3099df5498722f6390447f40bd3907b8e40c4 [formerly 3076df585565fc9759ab3e718270f2e5ef620840]] Former-commit-id: 92d52f967d0b088d1271afef26069e08cacd6b0f [formerly 5fe27e2ead104278951c772c2121a7b677f88d4d] Former-commit-id: fb6c2456d8edd3ec022d5d953f79fecdd4f2b8f4
This commit is contained in:
53
src/Nazara/VulkanRenderer/VkDescriptorPool.cpp
Normal file
53
src/Nazara/VulkanRenderer/VkDescriptorPool.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Vulkan Renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/VulkanRenderer/VkDescriptorPool.hpp>
|
||||
#include <Nazara/VulkanRenderer/VkDescriptorSet.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
namespace Vk
|
||||
{
|
||||
DescriptorSet DescriptorPool::AllocateDescriptorSet(const VkDescriptorSetLayout& setLayouts)
|
||||
{
|
||||
VkDescriptorSetAllocateInfo createInfo =
|
||||
{
|
||||
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, // VkStructureType sType;
|
||||
nullptr, // const void* pNext;
|
||||
m_handle, // VkDescriptorPool descriptorPool;
|
||||
1U, // uint32_t descriptorSetCount;
|
||||
&setLayouts // const VkDescriptorSetLayout* pSetLayouts;
|
||||
};
|
||||
|
||||
VkDescriptorSet handle = VK_NULL_HANDLE;
|
||||
m_lastErrorCode = m_device->vkAllocateDescriptorSets(*m_device, &createInfo, &handle);
|
||||
|
||||
return DescriptorSet(*this, handle);
|
||||
}
|
||||
|
||||
std::vector<DescriptorSet> DescriptorPool::AllocateDescriptorSets(UInt32 descriptorSetCount, const VkDescriptorSetLayout* setLayouts)
|
||||
{
|
||||
VkDescriptorSetAllocateInfo createInfo =
|
||||
{
|
||||
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, // VkStructureType sType;
|
||||
nullptr, // const void* pNext;
|
||||
m_handle, // VkDescriptorPool descriptorPool;
|
||||
descriptorSetCount, // uint32_t descriptorSetCount;
|
||||
setLayouts // const VkDescriptorSetLayout* pSetLayouts;
|
||||
};
|
||||
|
||||
std::vector<VkDescriptorSet> handles(descriptorSetCount, VK_NULL_HANDLE);
|
||||
m_lastErrorCode = m_device->vkAllocateDescriptorSets(*m_device, &createInfo, handles.data());
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
return std::vector<DescriptorSet>();
|
||||
|
||||
std::vector<DescriptorSet> descriptorSets;
|
||||
for (UInt32 i = 0; i < descriptorSetCount; ++i)
|
||||
descriptorSets.emplace_back(DescriptorSet(*this, handles[i]));
|
||||
|
||||
return descriptorSets;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user