增加DescriptorPool创建
This commit is contained in:
parent
7461b7edf3
commit
f80a4ecf54
@ -130,6 +130,9 @@ RenderSurfaceAttribute::RenderSurfaceAttribute(VkInstance inst,VkPhysicalDevice
|
|||||||
|
|
||||||
RenderSurfaceAttribute::~RenderSurfaceAttribute()
|
RenderSurfaceAttribute::~RenderSurfaceAttribute()
|
||||||
{
|
{
|
||||||
|
if(desc_pool)
|
||||||
|
vkDestroyDescriptorPool(device,desc_pool,nullptr);
|
||||||
|
|
||||||
if(depth.view)
|
if(depth.view)
|
||||||
vkDestroyImageView(device,depth.view,nullptr);
|
vkDestroyImageView(device,depth.view,nullptr);
|
||||||
|
|
||||||
|
@ -47,6 +47,8 @@ struct RenderSurfaceAttribute
|
|||||||
VkImageView view =nullptr;
|
VkImageView view =nullptr;
|
||||||
}depth;
|
}depth;
|
||||||
|
|
||||||
|
VkDescriptorPool desc_pool =nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RenderSurfaceAttribute(VkInstance inst,VkPhysicalDevice pd,VkSurfaceKHR s);
|
RenderSurfaceAttribute(VkInstance inst,VkPhysicalDevice pd,VkSurfaceKHR s);
|
||||||
|
@ -259,6 +259,33 @@ namespace
|
|||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VkDescriptorPool CreateDescriptorPool(VkDevice device,int sets_count)
|
||||||
|
{
|
||||||
|
constexpr size_t DESC_POOL_COUNT=1;
|
||||||
|
|
||||||
|
VkDescriptorPoolSize pool_size[DESC_POOL_COUNT];
|
||||||
|
|
||||||
|
for(size_t i=0;i<DESC_POOL_COUNT;i++)
|
||||||
|
{
|
||||||
|
pool_size[i].type=VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||||
|
pool_size[i].descriptorCount=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
VkDescriptorPoolCreateInfo dp_create_info={};
|
||||||
|
dp_create_info.sType=VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||||
|
dp_create_info.pNext=NULL;
|
||||||
|
dp_create_info.maxSets=sets_count;
|
||||||
|
dp_create_info.poolSizeCount=DESC_POOL_COUNT;
|
||||||
|
dp_create_info.pPoolSizes=pool_size;
|
||||||
|
|
||||||
|
VkDescriptorPool desc_pool;
|
||||||
|
|
||||||
|
if(!vkCreateDescriptorPool(device,&dp_create_info,nullptr,&desc_pool))
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
|
return desc_pool;
|
||||||
|
}
|
||||||
}//namespace
|
}//namespace
|
||||||
|
|
||||||
RenderSurface *CreateRenderSuface(VkInstance inst,VkPhysicalDevice physical_device,Window *win)
|
RenderSurface *CreateRenderSuface(VkInstance inst,VkPhysicalDevice physical_device,Window *win)
|
||||||
@ -296,6 +323,11 @@ RenderSurface *CreateRenderSuface(VkInstance inst,VkPhysicalDevice physical_devi
|
|||||||
if(!CreateDepthBuffer(rsa))
|
if(!CreateDepthBuffer(rsa))
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
|
rsa->desc_pool=CreateDescriptorPool(rsa->device,1);
|
||||||
|
|
||||||
|
if(!rsa->desc_pool)
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
return(new RenderSurface(rsa));
|
return(new RenderSurface(rsa));
|
||||||
}
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user