Skip to content

Commit

Permalink
Remove unused functionality from descpool
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Oct 11, 2023
1 parent 0ad2827 commit f769b2c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 18 deletions.
3 changes: 0 additions & 3 deletions Common/GPU/Vulkan/VulkanDescSet.cpp
Expand Up @@ -81,7 +81,6 @@ void VulkanDescSetPool::Reset() {
_assert_msg_(descPool_ != VK_NULL_HANDLE, "VulkanDescSetPool::Reset without valid pool");
vkResetDescriptorPool(vulkan_->GetDevice(), descPool_, 0);

clear_();
usage_ = 0;
}

Expand All @@ -90,7 +89,6 @@ void VulkanDescSetPool::Destroy() {

if (descPool_ != VK_NULL_HANDLE) {
vulkan_->Delete().QueueDeleteDescriptorPool(descPool_);
clear_();
usage_ = 0;
}
sizes_.clear();
Expand All @@ -110,7 +108,6 @@ VkResult VulkanDescSetPool::Recreate(bool grow) {
if (descPool_ != VK_NULL_HANDLE) {
INFO_LOG(G3D, "Reallocating %s desc pool from %d to %d", tag_, prevSize, info_.maxSets);
vulkan_->Delete().QueueDeleteDescriptorPool(descPool_);
clear_();
usage_ = 0;
}

Expand Down
13 changes: 2 additions & 11 deletions Common/GPU/Vulkan/VulkanDescSet.h
Expand Up @@ -3,7 +3,6 @@
#include "Common/Data/Collections/FastVec.h"
#include "Common/GPU/Vulkan/VulkanContext.h"

#include <functional>
#include <vector>

enum class BindingType {
Expand All @@ -18,23 +17,16 @@ enum class BindingType {
// Only appropriate for use in a per-frame pool.
class VulkanDescSetPool {
public:
VulkanDescSetPool(const char *tag = "", bool grow = true) : tag_(tag), grow_(grow) {}
VulkanDescSetPool(const char *tag, bool grow = true) : tag_(tag), grow_(grow) {}
~VulkanDescSetPool();

// Must call this before use: defines how to clear cache of ANY returned values from Allocate().
void Setup(const std::function<void()> &clear) {
clear_ = clear;
}
void Create(VulkanContext *vulkan, const BindingType *bindingTypes, uint32_t bindingTypesCount, uint32_t descriptorCount);
// Allocate a new set, which may resize and empty the current sets.
// Use only for the current frame, unless in a cache cleared by clear_.
// Use only for the current frame.
bool Allocate(VkDescriptorSet *descriptorSets, int count, const VkDescriptorSetLayout *layouts);
void Reset();
void Destroy();

void SetTag(const char *tag) {
tag_ = tag;
}
bool IsDestroyed() const {
return !descPool_;
}
Expand All @@ -47,7 +39,6 @@ class VulkanDescSetPool {
VkDescriptorPool descPool_ = VK_NULL_HANDLE;
VkDescriptorPoolCreateInfo info_{};
std::vector<VkDescriptorPoolSize> sizes_;
std::function<void()> clear_;
uint32_t usage_ = 0;
bool grow_;
};
1 change: 0 additions & 1 deletion Common/GPU/Vulkan/VulkanRenderManager.cpp
Expand Up @@ -1655,7 +1655,6 @@ VKRPipelineLayout *VulkanRenderManager::CreatePipelineLayout(BindingType *bindin
for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) {
// Some games go beyond 1024 and end up having to resize like GTA, but most stay below so we start there.
layout->frameData[i].pool.Create(vulkan_, bindingTypes, (uint32_t)bindingTypesCount, 1024);
layout->frameData[i].pool.Setup([]() {});
}

pipelineLayouts_.push_back(layout);
Expand Down
1 change: 1 addition & 0 deletions Common/GPU/Vulkan/VulkanRenderManager.h
Expand Up @@ -221,6 +221,7 @@ struct VKRPipelineLayout {
const char *tag = nullptr;

struct FrameData {
FrameData() : pool("GameDescPool", true) {}
VulkanDescSetPool pool;
FastVec<PackedDescriptor> descData_;
FastVec<PendingDescSet> descSets_;
Expand Down
4 changes: 1 addition & 3 deletions GPU/Vulkan/VulkanUtil.h
Expand Up @@ -72,9 +72,7 @@ class VulkanComputeShaderManager {
VkPipelineCache pipelineCache_ = VK_NULL_HANDLE;

struct FrameData {
FrameData() : descPool("VulkanComputeShaderManager", true) {
descPool.Setup([] { });
}
FrameData() : descPool("VulkanComputeShaderManager", true) {}

VulkanDescSetPool descPool;
bool descPoolUsed = false;
Expand Down

0 comments on commit f769b2c

Please sign in to comment.