Created a descriptor pool for Graphics System
This commit is contained in:
parent
fe954271cb
commit
d7954245d6
|
@ -7,32 +7,52 @@
|
|||
|
||||
namespace SHADE
|
||||
{
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Constructor/Destructor */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
SHVkDescriptorPool::SHVkDescriptorPool(Handle<SHVkLogicalDevice> device, const Config& config)
|
||||
: device { device }
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Constructor/Destructor */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
SHVkDescriptorPool::SHVkDescriptorPool(Handle<SHVkLogicalDevice> device, const Config& config)
|
||||
: device{ device }
|
||||
{
|
||||
// Create the Pool
|
||||
const vk::DescriptorPoolCreateInfo POOL_CREATE_INFO
|
||||
{
|
||||
// Create the Pool
|
||||
const vk::DescriptorPoolCreateInfo POOL_CREATE_INFO
|
||||
{
|
||||
.flags = config.Flags,
|
||||
.maxSets = config.MaxSets,
|
||||
.poolSizeCount = static_cast<uint32_t>(config.Limits.size()),
|
||||
.pPoolSizes = config.Limits.data()
|
||||
};
|
||||
pool = device->GetVkLogicalDevice().createDescriptorPool(POOL_CREATE_INFO);
|
||||
}
|
||||
.flags = config.Flags,
|
||||
.maxSets = config.MaxSets,
|
||||
.poolSizeCount = static_cast<uint32_t>(config.Limits.size()),
|
||||
.pPoolSizes = config.Limits.data()
|
||||
};
|
||||
pool = device->GetVkLogicalDevice().createDescriptorPool(POOL_CREATE_INFO);
|
||||
}
|
||||
|
||||
SHVkDescriptorPool::~SHVkDescriptorPool() noexcept
|
||||
{
|
||||
if (pool)
|
||||
device->GetVkLogicalDevice().destroyDescriptorPool(pool);
|
||||
}
|
||||
SHVkDescriptorPool::SHVkDescriptorPool(SHVkDescriptorPool&& rhs) noexcept
|
||||
: device{ rhs.device }
|
||||
, pool{ rhs.pool }
|
||||
{
|
||||
rhs.pool = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
std::vector<Handle<SHVkDescriptorSetGroup>> SHVkDescriptorPool::Allocate(const std::vector<Handle<SHVkDescriptorSetLayout>>& layouts, std::vector<uint32_t> const& variableDescCounts)
|
||||
{
|
||||
SHVkInstance::GetResourceManager().Create<SHVkDescriptorSetGroup>(device, GetHandle(), layouts, variableDescCounts);
|
||||
return {};
|
||||
}
|
||||
SHVkDescriptorPool::~SHVkDescriptorPool() noexcept
|
||||
{
|
||||
if (pool)
|
||||
device->GetVkLogicalDevice().destroyDescriptorPool(pool);
|
||||
}
|
||||
|
||||
SHVkDescriptorPool& SHVkDescriptorPool::operator=(SHVkDescriptorPool&& rhs) noexcept
|
||||
{
|
||||
if (&rhs == this)
|
||||
return *this;
|
||||
|
||||
device = rhs.device;
|
||||
pool = rhs.pool;
|
||||
|
||||
rhs.pool = VK_NULL_HANDLE;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::vector<Handle<SHVkDescriptorSetGroup>> SHVkDescriptorPool::Allocate(const std::vector<Handle<SHVkDescriptorSetLayout>>& layouts, std::vector<uint32_t> const& variableDescCounts)
|
||||
{
|
||||
SHVkInstance::GetResourceManager().Create<SHVkDescriptorSetGroup>(device, GetHandle(), layouts, variableDescCounts);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace SHADE
|
|||
/// </param>
|
||||
SHVkDescriptorPool(Handle<SHVkLogicalDevice> device, const Config& config = {});
|
||||
SHVkDescriptorPool(const SHVkDescriptorPool&) = delete;
|
||||
SHVkDescriptorPool(SHVkDescriptorPool&& rhs) noexcept = default;
|
||||
SHVkDescriptorPool(SHVkDescriptorPool&& rhs) noexcept;
|
||||
/// <summary>
|
||||
/// Destructor which will unload and deallocate all resources for this Pool.
|
||||
/// </summary>
|
||||
|
@ -75,7 +75,7 @@ namespace SHADE
|
|||
/* Overloaded Operators */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
SHVkDescriptorPool& operator=(const SHVkDescriptorPool&) = delete;
|
||||
SHVkDescriptorPool& operator=(SHVkDescriptorPool&& rhs) noexcept = default;
|
||||
SHVkDescriptorPool& operator=(SHVkDescriptorPool&& rhs) noexcept;
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Getter Functions */
|
||||
|
|
|
@ -509,6 +509,12 @@ namespace SHADE
|
|||
|
||||
}
|
||||
|
||||
Handle<SHVkDescriptorPool> SHVkLogicalDevice::CreateDescriptorPools(const SHVkDescriptorPool::Config& config /*= {}*/) noexcept
|
||||
{
|
||||
return SHVkInstance::GetResourceManager().Create <SHVkDescriptorPool>(GetHandle(), config);
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "Graphics/Pipeline/SHPipelineState.h"
|
||||
#include "Graphics/Pipeline/SHPipelineType.h"
|
||||
#include "vk_mem_alloc.h"
|
||||
//#include "Graphics/DescriptorSets/SHDescriptorPool.h"
|
||||
#include "Graphics/Descriptors/SHVkDescriptorPool.h"
|
||||
#include "Graphics/Descriptors/SHVkDescriptorSetLayout.h"
|
||||
|
||||
namespace SHADE
|
||||
|
@ -165,6 +165,7 @@ namespace SHADE
|
|||
Handle<SHVkRenderpass> CreateRenderpass (std::span<vk::AttachmentDescription> const vkDescriptions, std::span<vk::SubpassDescription> const spDescs, std::span<vk::SubpassDependency> const spDeps) noexcept;
|
||||
Handle<SHVkFramebuffer> CreateFramebuffer (Handle<SHVkRenderpass> const& renderpassHdl, std::vector<Handle<SHVkImageView>> const& attachments, uint32_t inWidth, uint32_t inHeight) noexcept;
|
||||
Handle<SHVkDescriptorSetLayout> CreateDescriptorSetLayout (std::vector<SHVkDescriptorSetLayout::Binding> const& bindings) noexcept;
|
||||
Handle<SHVkDescriptorPool> CreateDescriptorPools (const SHVkDescriptorPool::Config& config = {}) noexcept;
|
||||
Handle<SHVkPipelineLayout> CreatePipelineLayout (SHPipelineLayoutParams& pipelineLayoutParams) noexcept;
|
||||
Handle<SHVkFence> CreateFence (void) const noexcept;
|
||||
Handle<SHVkSemaphore> CreateSemaphore (void) const noexcept;
|
||||
|
|
|
@ -86,6 +86,8 @@ namespace SHADE
|
|||
|
||||
|
||||
|
||||
descPool = device->CreateDescriptorPools();
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
|
|
@ -22,6 +22,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Graphics/MiddleEnd/PerFrame/SHRenderContext.h"
|
||||
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
||||
#include "Engine/ECS_Base/System/SHSystem.h"
|
||||
#include "Graphics/Descriptors/SHVkDescriptorPool.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -113,7 +114,8 @@ namespace SHADE
|
|||
Handle<SHVkSwapchain> GetSwapchain() const { return swapchain; }
|
||||
Handle<SHVkSurface> GetSurface() const { return surface; }
|
||||
Handle<SHVkPhysicalDevice> GetPhysicalDevice() const {return physicalDevice;}
|
||||
Handle<SHVkQueue> GetQueue () const {return queue;}
|
||||
Handle<SHVkQueue> GetQueue() const { return queue; }
|
||||
Handle<SHVkDescriptorPool> GetDescriptorPool() const { return descPool; }
|
||||
//Handle<SHVkRenderpass> GetRenderPass() const { return renderPass; }
|
||||
|
||||
|
||||
|
@ -127,6 +129,7 @@ namespace SHADE
|
|||
Handle<SHVkSurface> surface;
|
||||
Handle<SHVkSwapchain> swapchain;
|
||||
Handle<SHVkQueue> queue;
|
||||
Handle<SHVkDescriptorPool> descPool;
|
||||
//Handle<SHVkRenderpass> renderPass; // Potentially bring out?
|
||||
std::vector<SHScreenSegment> screenSegments;
|
||||
SHRenderContext renderContext;
|
||||
|
|
Loading…
Reference in New Issue