Skip to content

Commit 4b5ac34

Browse files
committed
processCopy. But ILogicalDevice::updateDescriptorSets is not exactly correct.
1 parent 2275fb0 commit 4b5ac34

File tree

3 files changed

+43
-38
lines changed

3 files changed

+43
-38
lines changed

include/nbl/video/IDescriptorPool.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,7 @@ class IDescriptorPool : public core::IReferenceCounted, public IBackendObject
107107

108108
virtual ~IDescriptorPool()
109109
{
110-
if (allowsFreeing())
111-
{
112-
assert(m_descriptorSetAllocator.get_allocated_size() == 0);
113-
#ifdef _NBL_DEBUG
114-
for (uint32_t i = 0u; i < m_creationParameters.maxSets; ++i)
115-
assert(m_allocatedDescriptorSets[i] == nullptr);
116-
#endif
117-
}
110+
assert(m_descriptorSetAllocator.get_allocated_size() == 0);
118111
}
119112

120113
virtual bool createDescriptorSets_impl(uint32_t count, const IGPUDescriptorSetLayout* const* layouts, SStorageOffsets* const offsets, core::smart_refctd_ptr<IGPUDescriptorSet>* output) = 0;

src/nbl/video/IGPUDescriptorSet.cpp

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,27 +82,58 @@ bool IGPUDescriptorSet::processWrite(const IGPUDescriptorSet::SWriteDescriptorSe
8282

8383
bool IGPUDescriptorSet::processCopy(const IGPUDescriptorSet::SCopyDescriptorSet& copy)
8484
{
85-
#if 0
8685
assert(copy.dstSet == this);
8786

87+
system::ILogger* logger = nullptr;
88+
{
89+
auto debugCallback = getOriginDevice()->getPhysicalDevice()->getDebugCallback();
90+
if (debugCallback)
91+
logger = debugCallback->getLogger();
92+
}
93+
8894
for (uint32_t t = 0; t < static_cast<uint32_t>(asset::IDescriptor::E_TYPE::ET_COUNT); ++t)
8995
{
9096
const auto type = static_cast<asset::IDescriptor::E_TYPE>(t);
9197

92-
auto* srcDescriptors = srcDS->getDescriptors(type, pDescriptorCopies[i].srcBinding);
93-
auto* srcSamplers = srcDS->getMutableSamplers(pDescriptorCopies[i].srcBinding);
98+
auto* srcDescriptors = copy.srcSet->getDescriptors(type, copy.srcBinding);
99+
if (!srcDescriptors)
100+
{
101+
if (logger)
102+
logger->log("Expected descriptors of given type at binding %u for the src descriptor set but none found.", system::ILogger::ELL_ERROR, copy.srcBinding);
103+
return false;
104+
}
105+
106+
auto* srcSamplers = copy.srcSet->getMutableSamplers(copy.srcBinding);
107+
if (!srcSamplers)
108+
{
109+
if (logger)
110+
logger->log("Expected mutable samplers at binding %u for the src descriptor set, but none found", system::ILogger::ELL_ERROR, copy.srcBinding);
111+
return false;
112+
}
94113

95-
auto* dstDescriptors = dstDS->getDescriptors(type, pDescriptorCopies[i].dstBinding);
96-
auto* dstSamplers = dstDS->getMutableSamplers(pDescriptorCopies[i].dstBinding);
114+
auto* dstDescriptors = copy.dstSet->getDescriptors(type, copy.dstBinding);
115+
if (!dstDescriptors)
116+
{
117+
if (logger)
118+
logger->log("Expected descriptors of given type at binding %u for the dst descriptor set but none found.", system::ILogger::ELL_ERROR, copy.dstBinding);
119+
return false;
120+
}
97121

98-
if (srcDescriptors && dstDescriptors)
99-
std::copy_n(srcDescriptors, pDescriptorCopies[i].count, dstDescriptors);
122+
auto* dstSamplers = copy.dstSet->getMutableSamplers(copy.dstBinding);
123+
if (!dstSamplers)
124+
{
125+
if (logger)
126+
logger->log("Expected mutable samplers at binding %u for the dst descriptor set, but none found", system::ILogger::ELL_ERROR, copy.dstBinding);
127+
return false;
128+
}
100129

101-
if (srcSamplers && dstSamplers)
102-
std::copy_n(srcSamplers, pDescriptorCopies[i].count, dstSamplers);
130+
std::copy_n(srcDescriptors, copy.count, dstDescriptors);
131+
std::copy_n(srcSamplers, copy.count, dstSamplers);
103132
}
104-
#endif
105-
return false;
133+
134+
incrementVersion();
135+
136+
return true;
106137
}
107138

108139
}

src/nbl/video/ILogicalDevice.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,12 @@ bool ILogicalDevice::updateDescriptorSets(uint32_t descriptorWriteCount, const I
3838
return false;
3939
}
4040

41-
#if 0
4241
for (auto i = 0; i < descriptorCopyCount; ++i)
4342
{
4443
auto* dstDS = static_cast<IGPUDescriptorSet*>(pDescriptorCopies[i].dstSet);
4544
if (!dstDS->processCopy(pDescriptorCopies[i]))
4645
return false;
47-
48-
for (uint32_t t = 0; t < static_cast<uint32_t>(asset::IDescriptor::E_TYPE::ET_COUNT); ++t)
49-
{
50-
const auto type = static_cast<asset::IDescriptor::E_TYPE>(t);
51-
52-
auto* srcDescriptors = srcDS->getDescriptors(type, pDescriptorCopies[i].srcBinding);
53-
auto* srcSamplers = srcDS->getMutableSamplers(pDescriptorCopies[i].srcBinding);
54-
55-
auto* dstDescriptors = dstDS->getDescriptors(type, pDescriptorCopies[i].dstBinding);
56-
auto* dstSamplers = dstDS->getMutableSamplers(pDescriptorCopies[i].dstBinding);
57-
58-
if (srcDescriptors && dstDescriptors)
59-
std::copy_n(srcDescriptors, pDescriptorCopies[i].count, dstDescriptors);
60-
61-
if (srcSamplers && dstSamplers)
62-
std::copy_n(srcSamplers, pDescriptorCopies[i].count, dstSamplers);
63-
}
6446
}
65-
#endif
6647

6748
updateDescriptorSets_impl(descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
6849

0 commit comments

Comments
 (0)