renderer_vulkan: Allocate descriptor sets during reinterpretation
This commit is contained in:
@ -99,13 +99,6 @@ void main() {
|
|||||||
|
|
||||||
compute_pipeline_layout = device.createPipelineLayout(layout_info);
|
compute_pipeline_layout = device.createPipelineLayout(layout_info);
|
||||||
|
|
||||||
const vk::DescriptorSetAllocateInfo alloc_info = {.descriptorPool =
|
|
||||||
scheduler.GetPersistentDescriptorPool(),
|
|
||||||
.descriptorSetCount = 1,
|
|
||||||
.pSetLayouts = &descriptor_layout};
|
|
||||||
|
|
||||||
descriptor_set = device.allocateDescriptorSets(alloc_info)[0];
|
|
||||||
|
|
||||||
const vk::PipelineShaderStageCreateInfo compute_stage = {
|
const vk::PipelineShaderStageCreateInfo compute_stage = {
|
||||||
.stage = vk::ShaderStageFlagBits::eCompute, .module = compute_shader, .pName = "main"};
|
.stage = vk::ShaderStageFlagBits::eCompute, .module = compute_shader, .pName = "main"};
|
||||||
|
|
||||||
@ -144,10 +137,16 @@ void D24S8toRGBA8::Reinterpret(Surface& source, VideoCore::Rect2D src_rect, Surf
|
|||||||
vk::DescriptorImageInfo{.imageView = dest.GetImageView(),
|
vk::DescriptorImageInfo{.imageView = dest.GetImageView(),
|
||||||
.imageLayout = vk::ImageLayout::eGeneral}};
|
.imageLayout = vk::ImageLayout::eGeneral}};
|
||||||
|
|
||||||
|
const vk::DescriptorSetAllocateInfo alloc_info = {.descriptorPool =
|
||||||
|
scheduler.GetDescriptorPool(),
|
||||||
|
.descriptorSetCount = 1,
|
||||||
|
.pSetLayouts = &descriptor_layout};
|
||||||
|
|
||||||
|
descriptor_set = device.allocateDescriptorSets(alloc_info)[0];
|
||||||
|
|
||||||
device.updateDescriptorSetWithTemplate(descriptor_set, update_template, textures[0]);
|
device.updateDescriptorSetWithTemplate(descriptor_set, update_template, textures[0]);
|
||||||
command_buffer.bindDescriptorSets(vk::PipelineBindPoint::eCompute, compute_pipeline_layout, 0,
|
command_buffer.bindDescriptorSets(vk::PipelineBindPoint::eCompute, compute_pipeline_layout, 0,
|
||||||
1, &descriptor_set, 0, nullptr);
|
1, &descriptor_set, 0, nullptr);
|
||||||
|
|
||||||
command_buffer.bindPipeline(vk::PipelineBindPoint::eCompute, compute_pipeline);
|
command_buffer.bindPipeline(vk::PipelineBindPoint::eCompute, compute_pipeline);
|
||||||
|
|
||||||
const auto src_offset = Common::MakeVec(src_rect.left, src_rect.bottom);
|
const auto src_offset = Common::MakeVec(src_rect.left, src_rect.bottom);
|
||||||
|
@ -35,15 +35,14 @@ TaskScheduler::TaskScheduler(const Instance& instance, RendererVulkan& renderer)
|
|||||||
vk::DescriptorPoolSize{vk::DescriptorType::eSampledImage, 2048},
|
vk::DescriptorPoolSize{vk::DescriptorType::eSampledImage, 2048},
|
||||||
vk::DescriptorPoolSize{vk::DescriptorType::eCombinedImageSampler, 512},
|
vk::DescriptorPoolSize{vk::DescriptorType::eCombinedImageSampler, 512},
|
||||||
vk::DescriptorPoolSize{vk::DescriptorType::eSampler, 2048},
|
vk::DescriptorPoolSize{vk::DescriptorType::eSampler, 2048},
|
||||||
vk::DescriptorPoolSize{vk::DescriptorType::eUniformTexelBuffer, 1024}};
|
vk::DescriptorPoolSize{vk::DescriptorType::eUniformTexelBuffer, 1024},
|
||||||
|
vk::DescriptorPoolSize{vk::DescriptorType::eStorageImage, 1024}};
|
||||||
|
|
||||||
const vk::DescriptorPoolCreateInfo descriptor_pool_info = {
|
const vk::DescriptorPoolCreateInfo descriptor_pool_info = {
|
||||||
.maxSets = 2048,
|
.maxSets = 2048,
|
||||||
.poolSizeCount = static_cast<u32>(pool_sizes.size()),
|
.poolSizeCount = static_cast<u32>(pool_sizes.size()),
|
||||||
.pPoolSizes = pool_sizes.data()};
|
.pPoolSizes = pool_sizes.data()};
|
||||||
|
|
||||||
persistent_descriptor_pool = device.createDescriptorPool(descriptor_pool_info);
|
|
||||||
|
|
||||||
const vk::CommandBufferAllocateInfo buffer_info = {.commandPool = command_pool,
|
const vk::CommandBufferAllocateInfo buffer_info = {.commandPool = command_pool,
|
||||||
.level = vk::CommandBufferLevel::ePrimary,
|
.level = vk::CommandBufferLevel::ePrimary,
|
||||||
.commandBufferCount =
|
.commandBufferCount =
|
||||||
@ -86,7 +85,6 @@ TaskScheduler::~TaskScheduler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
device.destroyCommandPool(command_pool);
|
device.destroyCommandPool(command_pool);
|
||||||
device.destroyDescriptorPool(persistent_descriptor_pool);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskScheduler::Synchronize(u32 slot) {
|
void TaskScheduler::Synchronize(u32 slot) {
|
||||||
|
@ -52,11 +52,6 @@ public:
|
|||||||
return commands[current_command].descriptor_pool;
|
return commands[current_command].descriptor_pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the persistent descriptor pool
|
|
||||||
vk::DescriptorPool GetPersistentDescriptorPool() const {
|
|
||||||
return persistent_descriptor_pool;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the index of the current command slot
|
/// Returns the index of the current command slot
|
||||||
u32 GetCurrentSlotIndex() const {
|
u32 GetCurrentSlotIndex() const {
|
||||||
return current_command;
|
return current_command;
|
||||||
@ -97,7 +92,6 @@ private:
|
|||||||
|
|
||||||
vk::CommandPool command_pool{};
|
vk::CommandPool command_pool{};
|
||||||
vk::Semaphore timeline{};
|
vk::Semaphore timeline{};
|
||||||
vk::DescriptorPool persistent_descriptor_pool;
|
|
||||||
std::array<ExecutionSlot, SCHEDULER_COMMAND_COUNT> commands{};
|
std::array<ExecutionSlot, SCHEDULER_COMMAND_COUNT> commands{};
|
||||||
u32 current_command = 0;
|
u32 current_command = 0;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user