mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Step 1
This commit is contained in:
parent
f1bc547e94
commit
f301035ba0
3 changed files with 33 additions and 17 deletions
|
@ -85,8 +85,6 @@ void VulkanDescSetPool::Reset() {
|
|||
}
|
||||
|
||||
void VulkanDescSetPool::Destroy() {
|
||||
_assert_msg_(vulkan_ != nullptr, "VulkanDescSetPool::Destroy without VulkanContext");
|
||||
|
||||
if (descPool_ != VK_NULL_HANDLE) {
|
||||
vulkan_->Delete().QueueDeleteDescriptorPool(descPool_);
|
||||
usage_ = 0;
|
||||
|
@ -94,6 +92,14 @@ void VulkanDescSetPool::Destroy() {
|
|||
sizes_.clear();
|
||||
}
|
||||
|
||||
void VulkanDescSetPool::DestroyImmediately() {
|
||||
if (descPool_ != VK_NULL_HANDLE) {
|
||||
vkDestroyDescriptorPool(vulkan_->GetDevice(), descPool_, nullptr);
|
||||
usage_ = 0;
|
||||
}
|
||||
sizes_.clear();
|
||||
}
|
||||
|
||||
VkResult VulkanDescSetPool::Recreate(bool grow) {
|
||||
_assert_msg_(vulkan_ != nullptr, "VulkanDescSetPool::Recreate without VulkanContext");
|
||||
|
||||
|
|
|
@ -25,7 +25,11 @@ public:
|
|||
// Use only for the current frame.
|
||||
bool Allocate(VkDescriptorSet *descriptorSets, int count, const VkDescriptorSetLayout *layouts);
|
||||
void Reset();
|
||||
|
||||
// This queues up destruction.
|
||||
void Destroy();
|
||||
// This actually destroys immediately.
|
||||
void DestroyImmediately();
|
||||
|
||||
bool IsDestroyed() const {
|
||||
return !descPool_;
|
||||
|
|
|
@ -515,20 +515,18 @@ void VulkanRenderManager::CompileThreadFunc() {
|
|||
Task *task = new CreateMultiPipelinesTask(vulkan_, entries);
|
||||
g_threadManager.EnqueueTask(task);
|
||||
}
|
||||
|
||||
|
||||
queueRunner_.NotifyCompileDone();
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanRenderManager::DrainAndBlockCompileQueue() {
|
||||
EndCurRenderStep();
|
||||
std::unique_lock<std::mutex> lock(compileMutex_);
|
||||
compileBlocked_ = true;
|
||||
compileCond_.notify_all();
|
||||
while (!compileQueue_.empty()) {
|
||||
queueRunner_.WaitForCompileNotification();
|
||||
}
|
||||
FlushSync();
|
||||
}
|
||||
|
||||
void VulkanRenderManager::ReleaseCompileQueue() {
|
||||
|
@ -1662,19 +1660,27 @@ VKRPipelineLayout *VulkanRenderManager::CreatePipelineLayout(BindingType *bindin
|
|||
}
|
||||
|
||||
void VulkanRenderManager::DestroyPipelineLayout(VKRPipelineLayout *layout) {
|
||||
for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) {
|
||||
layout->frameData[i].pool.Destroy();
|
||||
}
|
||||
|
||||
vulkan_->Delete().QueueDeletePipelineLayout(layout->pipelineLayout);
|
||||
vulkan_->Delete().QueueDeleteDescriptorSetLayout(layout->descriptorSetLayout);
|
||||
for (auto iter = pipelineLayouts_.begin(); iter != pipelineLayouts_.end(); iter++) {
|
||||
if (*iter == layout) {
|
||||
pipelineLayouts_.erase(iter);
|
||||
break;
|
||||
struct DelInfo {
|
||||
VulkanRenderManager *rm;
|
||||
VKRPipelineLayout *layout;
|
||||
};
|
||||
vulkan_->Delete().QueueCallback([](VulkanContext *vulkan, void *userdata) {
|
||||
DelInfo *info = (DelInfo *)userdata;
|
||||
for (auto iter = info->rm->pipelineLayouts_.begin(); iter != info->rm->pipelineLayouts_.end(); iter++) {
|
||||
if (*iter == info->layout) {
|
||||
info->rm->pipelineLayouts_.erase(iter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete layout;
|
||||
for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) {
|
||||
info->layout->frameData[i].pool.DestroyImmediately();
|
||||
}
|
||||
vkDestroyPipelineLayout(vulkan->GetDevice(), info->layout->pipelineLayout, nullptr);
|
||||
vkDestroyDescriptorSetLayout(vulkan->GetDevice(), info->layout->descriptorSetLayout, nullptr);
|
||||
|
||||
delete info->layout;
|
||||
delete info;
|
||||
}, new DelInfo{this, layout});
|
||||
}
|
||||
|
||||
void VulkanRenderManager::FlushDescriptors(int frame) {
|
||||
|
|
Loading…
Add table
Reference in a new issue