[Vulkan] Create/Free Vertex Descriptor Pool
This commit is contained in:
parent
af406df793
commit
4be725c4b4
|
@ -134,6 +134,45 @@ VkResult BufferCache::Initialize() {
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult xe::gpu::vulkan::BufferCache::CreateVertexDescriptorPool() {
|
||||
VkResult status;
|
||||
|
||||
std::vector<VkDescriptorPoolSize> pool_sizes;
|
||||
pool_sizes.push_back({
|
||||
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
|
||||
4096,
|
||||
});
|
||||
vertex_descriptor_pool_ =
|
||||
std::make_unique<ui::vulkan::DescriptorPool>(*device_, 32768, pool_sizes);
|
||||
|
||||
// 32 storage buffers available to vertex shader.
|
||||
// TODO(DrChat): In the future, this could hold memexport staging data.
|
||||
VkDescriptorSetLayoutBinding binding = {
|
||||
0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
32, VK_SHADER_STAGE_VERTEX_BIT,
|
||||
nullptr,
|
||||
};
|
||||
|
||||
VkDescriptorSetLayoutCreateInfo layout_info = {
|
||||
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
|
||||
nullptr,
|
||||
0,
|
||||
1,
|
||||
&binding,
|
||||
};
|
||||
vkCreateDescriptorSetLayout(*device_, &layout_info, nullptr,
|
||||
&vertex_descriptor_set_layout_);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void xe::gpu::vulkan::BufferCache::FreeVertexDescriptorPool() {
|
||||
vertex_descriptor_pool_.reset();
|
||||
|
||||
VK_SAFE_DESTROY(vkDestroyDescriptorSetLayout, *device_,
|
||||
vertex_descriptor_set_layout_, nullptr);
|
||||
}
|
||||
|
||||
VkResult BufferCache::CreateConstantDescriptorSet() {
|
||||
VkResult status = VK_SUCCESS;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "xenia/gpu/xenos.h"
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/ui/vulkan/circular_buffer.h"
|
||||
#include "xenia/ui/vulkan/fenced_pools.h"
|
||||
#include "xenia/ui/vulkan/vulkan.h"
|
||||
#include "xenia/ui/vulkan/vulkan_device.h"
|
||||
|
||||
|
@ -106,6 +107,9 @@ class BufferCache {
|
|||
VmaAllocationInfo alloc_info;
|
||||
};
|
||||
|
||||
VkResult CreateVertexDescriptorPool();
|
||||
void FreeVertexDescriptorPool();
|
||||
|
||||
VkResult CreateConstantDescriptorSet();
|
||||
void FreeConstantDescriptorSet();
|
||||
|
||||
|
@ -136,6 +140,10 @@ class BufferCache {
|
|||
std::unique_ptr<ui::vulkan::CircularBuffer> transient_buffer_ = nullptr;
|
||||
std::map<uint32_t, std::pair<uint32_t, VkDeviceSize>> transient_cache_;
|
||||
|
||||
// Vertex buffer descriptors
|
||||
std::unique_ptr<ui::vulkan::DescriptorPool> vertex_descriptor_pool_ = nullptr;
|
||||
VkDescriptorSetLayout vertex_descriptor_set_layout_ = nullptr;
|
||||
|
||||
// Descriptor set used to hold vertex/pixel shader float constants
|
||||
VkDescriptorPool constant_descriptor_pool_ = nullptr;
|
||||
VkDescriptorSetLayout constant_descriptor_set_layout_ = nullptr;
|
||||
|
|
Loading…
Reference in New Issue