mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxvk] Rename new descriptor pool implementation to DxvkDescriptorPool
This commit is contained in:
parent
6aeed40af2
commit
eea5c9f0da
@ -756,7 +756,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
void trackDescriptorPool(
|
||||
const Rc<DxvkPersistentDescriptorPool>& pool,
|
||||
const Rc<DxvkDescriptorPool>& pool,
|
||||
const Rc<DxvkDescriptorManager>& manager) {
|
||||
m_descriptorPools.push_back({ pool, manager });
|
||||
}
|
||||
@ -787,7 +787,7 @@ namespace dxvk {
|
||||
DxvkStatCounters m_statCounters;
|
||||
|
||||
std::vector<std::pair<
|
||||
Rc<DxvkPersistentDescriptorPool>,
|
||||
Rc<DxvkDescriptorPool>,
|
||||
Rc<DxvkDescriptorManager>>> m_descriptorPools;
|
||||
|
||||
VkCommandBuffer getCmdBuffer(DxvkCmdBuffer cmdBuffer) const {
|
||||
|
@ -1057,7 +1057,7 @@ namespace dxvk {
|
||||
DxvkContextFeatures m_features;
|
||||
DxvkDescriptorState m_descriptorState;
|
||||
|
||||
Rc<DxvkPersistentDescriptorPool> m_descriptorPool;
|
||||
Rc<DxvkDescriptorPool> m_descriptorPool;
|
||||
Rc<DxvkDescriptorManager> m_descriptorManager;
|
||||
|
||||
DxvkBarrierSet m_sdmaAcquires;
|
||||
|
@ -3,17 +3,17 @@
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
DxvkPersistentDescriptorSetList::DxvkPersistentDescriptorSetList() {
|
||||
DxvkDescriptorSetList::DxvkDescriptorSetList() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
DxvkPersistentDescriptorSetList::~DxvkPersistentDescriptorSetList() {
|
||||
DxvkDescriptorSetList::~DxvkDescriptorSetList() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
VkDescriptorSet DxvkPersistentDescriptorSetList::alloc() {
|
||||
VkDescriptorSet DxvkDescriptorSetList::alloc() {
|
||||
if (unlikely(m_next == m_sets.size()))
|
||||
return VK_NULL_HANDLE;
|
||||
|
||||
@ -21,19 +21,19 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkPersistentDescriptorSetList::addSet(VkDescriptorSet set) {
|
||||
void DxvkDescriptorSetList::addSet(VkDescriptorSet set) {
|
||||
m_sets.push_back(set);
|
||||
m_next = m_sets.size();
|
||||
}
|
||||
|
||||
|
||||
void DxvkPersistentDescriptorSetList::reset() {
|
||||
void DxvkDescriptorSetList::reset() {
|
||||
m_next = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DxvkPersistentDescriptorPool::DxvkPersistentDescriptorPool(
|
||||
DxvkDescriptorPool::DxvkDescriptorPool(
|
||||
DxvkDevice* device,
|
||||
DxvkContextType contextType)
|
||||
: m_device(device), m_contextType(contextType),
|
||||
@ -42,7 +42,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxvkPersistentDescriptorPool::~DxvkPersistentDescriptorPool() {
|
||||
DxvkDescriptorPool::~DxvkDescriptorPool() {
|
||||
auto vk = m_device->vkd();
|
||||
|
||||
for (auto pool : m_descriptorPools)
|
||||
@ -50,7 +50,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkPersistentDescriptorPool::alloc(
|
||||
void DxvkDescriptorPool::alloc(
|
||||
const DxvkBindingLayoutObjects* layout,
|
||||
uint32_t setMask,
|
||||
VkDescriptorSet* sets) {
|
||||
@ -69,14 +69,14 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
VkDescriptorSet DxvkPersistentDescriptorPool::alloc(
|
||||
VkDescriptorSet DxvkDescriptorPool::alloc(
|
||||
VkDescriptorSetLayout layout) {
|
||||
auto setList = getSetList(layout);
|
||||
return allocSet(setList, layout);
|
||||
}
|
||||
|
||||
|
||||
void DxvkPersistentDescriptorPool::reset() {
|
||||
void DxvkDescriptorPool::reset() {
|
||||
// As a heuristic to save memory, check how many descriptors
|
||||
// have actively been used in the past couple of submissions.
|
||||
bool isLowUsageFrame = false;
|
||||
@ -118,7 +118,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxvkPersistentDescriptorSetMap* DxvkPersistentDescriptorPool::getSetMapCached(
|
||||
DxvkDescriptorSetMap* DxvkDescriptorPool::getSetMapCached(
|
||||
const DxvkBindingLayoutObjects* layout) {
|
||||
if (likely(m_cachedEntry.first == layout))
|
||||
return m_cachedEntry.second;
|
||||
@ -129,7 +129,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxvkPersistentDescriptorSetMap* DxvkPersistentDescriptorPool::getSetMap(
|
||||
DxvkDescriptorSetMap* DxvkDescriptorPool::getSetMap(
|
||||
const DxvkBindingLayoutObjects* layout) {
|
||||
auto pair = m_setMaps.find(layout->getPipelineLayout());
|
||||
if (likely(pair != m_setMaps.end())) {
|
||||
@ -151,7 +151,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxvkPersistentDescriptorSetList* DxvkPersistentDescriptorPool::getSetList(
|
||||
DxvkDescriptorSetList* DxvkDescriptorPool::getSetList(
|
||||
VkDescriptorSetLayout layout) {
|
||||
auto pair = m_setLists.find(layout);
|
||||
if (pair != m_setLists.end())
|
||||
@ -165,8 +165,8 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
VkDescriptorSet DxvkPersistentDescriptorPool::allocSet(
|
||||
DxvkPersistentDescriptorSetList* list,
|
||||
VkDescriptorSet DxvkDescriptorPool::allocSet(
|
||||
DxvkDescriptorSetList* list,
|
||||
VkDescriptorSetLayout layout) {
|
||||
VkDescriptorSet set = list->alloc();
|
||||
|
||||
@ -185,7 +185,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
VkDescriptorSet DxvkPersistentDescriptorPool::allocSetFromPool(
|
||||
VkDescriptorSet DxvkDescriptorPool::allocSetFromPool(
|
||||
VkDescriptorPool pool,
|
||||
VkDescriptorSetLayout layout) {
|
||||
auto vk = m_device->vkd();
|
||||
@ -204,7 +204,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
VkDescriptorPool DxvkPersistentDescriptorPool::addPool() {
|
||||
VkDescriptorPool DxvkDescriptorPool::addPool() {
|
||||
auto vk = m_device->vkd();
|
||||
|
||||
uint32_t maxSets = m_contextType == DxvkContextType::Primary
|
||||
@ -251,18 +251,18 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkPersistentDescriptorPool> DxvkDescriptorManager::getDescriptorPool() {
|
||||
Rc<DxvkPersistentDescriptorPool> pool = m_pools.retrieveObject();
|
||||
Rc<DxvkDescriptorPool> DxvkDescriptorManager::getDescriptorPool() {
|
||||
Rc<DxvkDescriptorPool> pool = m_pools.retrieveObject();
|
||||
|
||||
if (pool == nullptr)
|
||||
pool = new DxvkPersistentDescriptorPool(m_device, m_contextType);
|
||||
pool = new DxvkDescriptorPool(m_device, m_contextType);
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
|
||||
void DxvkDescriptorManager::recycleDescriptorPool(
|
||||
const Rc<DxvkPersistentDescriptorPool>& pool) {
|
||||
const Rc<DxvkDescriptorPool>& pool) {
|
||||
pool->reset();
|
||||
|
||||
m_pools.returnObject(pool);
|
||||
|
@ -36,12 +36,12 @@ namespace dxvk {
|
||||
/**
|
||||
* \brief Descriptor set list
|
||||
*/
|
||||
class DxvkPersistentDescriptorSetList {
|
||||
class DxvkDescriptorSetList {
|
||||
|
||||
public:
|
||||
|
||||
DxvkPersistentDescriptorSetList();
|
||||
~DxvkPersistentDescriptorSetList();
|
||||
DxvkDescriptorSetList();
|
||||
~DxvkDescriptorSetList();
|
||||
|
||||
VkDescriptorSet alloc();
|
||||
|
||||
@ -63,8 +63,8 @@ namespace dxvk {
|
||||
* Points to a list of set maps for each
|
||||
* defined set in a pipeline layout.
|
||||
*/
|
||||
struct DxvkPersistentDescriptorSetMap {
|
||||
std::array<DxvkPersistentDescriptorSetList*, DxvkDescriptorSets::SetCount> sets;
|
||||
struct DxvkDescriptorSetMap {
|
||||
std::array<DxvkDescriptorSetList*, DxvkDescriptorSets::SetCount> sets;
|
||||
};
|
||||
|
||||
|
||||
@ -77,15 +77,15 @@ namespace dxvk {
|
||||
* but allocated sets will have unspecified contents and need
|
||||
* to be updated.
|
||||
*/
|
||||
class DxvkPersistentDescriptorPool : public RcObject {
|
||||
class DxvkDescriptorPool : public RcObject {
|
||||
|
||||
public:
|
||||
|
||||
DxvkPersistentDescriptorPool(
|
||||
DxvkDescriptorPool(
|
||||
DxvkDevice* device,
|
||||
DxvkContextType contextType);
|
||||
|
||||
~DxvkPersistentDescriptorPool();
|
||||
~DxvkDescriptorPool();
|
||||
|
||||
/**
|
||||
* \brief Allocates one or multiple descriptor sets
|
||||
@ -118,26 +118,26 @@ namespace dxvk {
|
||||
DxvkDevice* m_device;
|
||||
DxvkContextType m_contextType;
|
||||
|
||||
std::vector<VkDescriptorPool> m_descriptorPools;
|
||||
std::unordered_map<VkDescriptorSetLayout, DxvkPersistentDescriptorSetList> m_setLists;
|
||||
std::unordered_map<VkPipelineLayout, DxvkPersistentDescriptorSetMap> m_setMaps;
|
||||
std::pair<const DxvkBindingLayoutObjects*, DxvkPersistentDescriptorSetMap*> m_cachedEntry;
|
||||
std::vector<VkDescriptorPool> m_descriptorPools;
|
||||
std::unordered_map<VkDescriptorSetLayout, DxvkDescriptorSetList> m_setLists;
|
||||
std::unordered_map<VkPipelineLayout, DxvkDescriptorSetMap> m_setMaps;
|
||||
std::pair<const DxvkBindingLayoutObjects*, DxvkDescriptorSetMap*> m_cachedEntry;
|
||||
|
||||
uint32_t m_setsAllocated = 0;
|
||||
uint32_t m_setsUsed = 0;
|
||||
uint32_t m_lowUsageFrames = 0;
|
||||
|
||||
DxvkPersistentDescriptorSetMap* getSetMapCached(
|
||||
DxvkDescriptorSetMap* getSetMapCached(
|
||||
const DxvkBindingLayoutObjects* layout);
|
||||
|
||||
DxvkPersistentDescriptorSetMap* getSetMap(
|
||||
DxvkDescriptorSetMap* getSetMap(
|
||||
const DxvkBindingLayoutObjects* layout);
|
||||
|
||||
DxvkPersistentDescriptorSetList* getSetList(
|
||||
DxvkDescriptorSetList* getSetList(
|
||||
VkDescriptorSetLayout layout);
|
||||
|
||||
VkDescriptorSet allocSet(
|
||||
DxvkPersistentDescriptorSetList* list,
|
||||
DxvkDescriptorSetList* list,
|
||||
VkDescriptorSetLayout layout);
|
||||
|
||||
VkDescriptorSet allocSetFromPool(
|
||||
@ -165,7 +165,7 @@ namespace dxvk {
|
||||
* \brief Retrieves or creates a descriptor type
|
||||
* \returns The descriptor pool
|
||||
*/
|
||||
Rc<DxvkPersistentDescriptorPool> getDescriptorPool();
|
||||
Rc<DxvkDescriptorPool> getDescriptorPool();
|
||||
|
||||
/**
|
||||
* \brief Recycles descriptor pool
|
||||
@ -174,13 +174,13 @@ namespace dxvk {
|
||||
* descriptor pool for future use.
|
||||
*/
|
||||
void recycleDescriptorPool(
|
||||
const Rc<DxvkPersistentDescriptorPool>& pool);
|
||||
const Rc<DxvkDescriptorPool>& pool);
|
||||
|
||||
private:
|
||||
|
||||
DxvkDevice* m_device;
|
||||
DxvkContextType m_contextType;
|
||||
DxvkRecycler<DxvkPersistentDescriptorPool, 8> m_pools;
|
||||
DxvkRecycler<DxvkDescriptorPool, 8> m_pools;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user