mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxvk] Add safety mechanism to submit large descriptor pools
This commit is contained in:
parent
cfc06405d2
commit
d4d87123b4
@ -103,9 +103,9 @@ namespace dxvk {
|
||||
m_initBarriers.recordCommands(m_cmd);
|
||||
m_execBarriers.recordCommands(m_cmd);
|
||||
|
||||
if (m_type != DxvkContextType::Primary) {
|
||||
if (m_descriptorPool->shouldSubmit(false)) {
|
||||
m_cmd->trackDescriptorPool(m_descriptorPool, m_descriptorManager);
|
||||
m_descriptorPool = nullptr;
|
||||
m_descriptorPool = m_descriptorManager->getDescriptorPool();
|
||||
}
|
||||
|
||||
m_cmd->endRecording();
|
||||
@ -114,7 +114,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkContext::endFrame() {
|
||||
if (m_descriptorPool != nullptr) {
|
||||
if (m_descriptorPool->shouldSubmit(true)) {
|
||||
m_cmd->trackDescriptorPool(m_descriptorPool, m_descriptorManager);
|
||||
m_descriptorPool = m_descriptorManager->getDescriptorPool();
|
||||
}
|
||||
|
@ -50,6 +50,24 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
bool DxvkDescriptorPool::shouldSubmit(bool endFrame) {
|
||||
// Never submit empty descriptor pools
|
||||
if (!m_setsAllocated)
|
||||
return false;
|
||||
|
||||
// No frame tracking for supplementary contexts, so
|
||||
// always submit those at the end of a command list
|
||||
if (endFrame || m_contextType != DxvkContextType::Primary)
|
||||
return true;
|
||||
|
||||
// Submit very large descriptor pools to prevent extreme
|
||||
// memory bloat. This may be necessary for off-screen
|
||||
// rendering applications, or in situations where games
|
||||
// pre-render a lot of images without presenting in between.
|
||||
return m_descriptorPools.size() >= 8;
|
||||
}
|
||||
|
||||
|
||||
void DxvkDescriptorPool::alloc(
|
||||
const DxvkBindingLayoutObjects* layout,
|
||||
uint32_t setMask,
|
||||
|
@ -88,6 +88,14 @@ namespace dxvk {
|
||||
|
||||
~DxvkDescriptorPool();
|
||||
|
||||
/**
|
||||
* \brief Tests whether the descriptor pool should be replaced
|
||||
*
|
||||
* \param [in] endFrame Whether this is the end of the frame
|
||||
* \returns \c true if the pool should be submitted
|
||||
*/
|
||||
bool shouldSubmit(bool endFrame);
|
||||
|
||||
/**
|
||||
* \brief Allocates one or multiple descriptor sets
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user