Skip to content

Commit ed3948b

Browse files
committed
CPipelineBarrierCmd needs the definition of S{Buffer/Image}MemoryBarrier. NOT COMPILING RIGHT NOW.
1 parent f297ece commit ed3948b

File tree

2 files changed

+14
-27
lines changed

2 files changed

+14
-27
lines changed

include/nbl/video/IGPUCommandPool.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "nbl/video/decl/IBackendObject.h"
1010
#include "nbl/video/IGPUPipelineLayout.h"
1111

12+
#include "nbl/asset/ICPUCommandBuffer.h"
13+
1214
namespace nbl::video
1315
{
1416
class IGPUCommandBuffer;
@@ -425,19 +427,19 @@ class IGPUCommandPool::CBeginRenderPassCmd : public IGPUCommandPool::IFixedSizeC
425427
class IGPUCommandPool::CPipelineBarrierCmd : public IGPUCommandPool::ICommand
426428
{
427429
public:
428-
CPipelineBarrierCmd(const uint32_t bufferCount, const core::smart_refctd_ptr<const IGPUBuffer>* buffers, const uint32_t imageCount, const core::smart_refctd_ptr<const IGPUImage>* images)
429-
: ICommand(calc_size(bufferCount, buffers, imageCount, images)), m_resourceCount(bufferCount+imageCount)
430+
CPipelineBarrierCmd(const uint32_t bufferCount, const asset::ICPUCommandBuffer::SBufferMemoryBarrier* bufferMemoryBarriers, const uint32_t imageCount, const asset::ICPUCommandBuffer::SImageMemoryBarrier* imageMemoryBarriers)
431+
: ICommand(calc_size(bufferCount, bufferMemoryBarriers, imageCount, imageMemoryBarriers)), m_resourceCount(bufferCount+imageCount)
430432
{
431433
auto barrierResources = getBarrierResources();
432434
std::uninitialized_default_construct_n(barrierResources, m_resourceCount);
433435

434436
uint32_t k = 0;
435437

436438
for (auto i = 0; i < bufferCount; ++i)
437-
barrierResources[k++] = buffers[i];
439+
barrierResources[k++] = bufferMemoryBarriers[i].buffer;
438440

439441
for (auto i = 0; i < imageCount; ++i)
440-
barrierResources[k++] = images[i];
442+
barrierResources[k++] = imageMemoryBarriers[i].image;
441443
}
442444

443445
~CPipelineBarrierCmd()
@@ -447,7 +449,7 @@ class IGPUCommandPool::CPipelineBarrierCmd : public IGPUCommandPool::ICommand
447449
barrierResources[i].~smart_refctd_ptr();
448450
}
449451

450-
static uint32_t calc_size(const uint32_t bufferCount, const core::smart_refctd_ptr<const IGPUBuffer>* buffers, const uint32_t imageCount, const core::smart_refctd_ptr<const IGPUImage>* images)
452+
static uint32_t calc_size(const uint32_t bufferCount, const asset::ICPUCommandBuffer::SBufferMemoryBarrier* bufferMemoryBarriers, const uint32_t imageCount, const asset::ICPUCommandBuffer::SImageMemoryBarrier* imageMemoryBarriers)
451453
{
452454
return core::alignUp(sizeof(CPipelineBarrierCmd) + (bufferCount+imageCount)*sizeof(core::smart_refctd_ptr<const core::IReferenceCounted>), alignof(CPipelineBarrierCmd));
453455
}
@@ -461,11 +463,14 @@ class IGPUCommandPool::CPipelineBarrierCmd : public IGPUCommandPool::ICommand
461463
class IGPUCommandPool::CBindDescriptorSetsCmd : public IGPUCommandPool::IFixedSizeCommand<CBindDescriptorSetsCmd>
462464
{
463465
public:
464-
CBindDescriptorSetsCmd(core::smart_refctd_ptr<const IGPUPipelineLayout>&& pipelineLayout, const uint32_t setCount, const core::smart_refctd_ptr<const IGPUDescriptorSet>* sets)
466+
CBindDescriptorSetsCmd(core::smart_refctd_ptr<const IGPUPipelineLayout>&& pipelineLayout, const uint32_t setCount, const IGPUDescriptorSet* const* const sets)
465467
: m_layout(std::move(pipelineLayout))
466468
{
467469
for (auto i = 0; i < setCount; ++i)
468-
m_sets[i] = sets[i];
470+
{
471+
assert(i < IGPUPipelineLayout::DESCRIPTOR_SET_COUNT);
472+
m_sets[i] = core::smart_refctd_ptr<const video::IGPUDescriptorSet>(sets[i]);
473+
}
469474
}
470475

471476
private:

src/nbl/video/IGPUCommandBuffer.cpp

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,7 @@ bool IGPUCommandBuffer::pipelineBarrier(core::bitflag<asset::E_PIPELINE_STAGE_FL
195195
if ((memoryBarrierCount == 0u) && (bufferMemoryBarrierCount == 0u) && (imageMemoryBarrierCount == 0u))
196196
return false;
197197

198-
constexpr auto MaxBarrierResourceCount = (1 << 12) / sizeof(void*);
199-
assert(bufferMemoryBarrierCount + imageMemoryBarrierCount <= MaxBarrierResourceCount);
200-
201-
core::smart_refctd_ptr<const IGPUBuffer> bufferResources[MaxBarrierResourceCount];
202-
for (auto i = 0; i < bufferMemoryBarrierCount; ++i)
203-
bufferResources[i] = pBufferMemoryBarriers[i].buffer;
204-
205-
core::smart_refctd_ptr<const IGPUImage> imageResources[MaxBarrierResourceCount];
206-
for (auto i = 0; i < imageMemoryBarrierCount; ++i)
207-
imageResources[i] = pImageMemoryBarriers[i].image;
208-
209-
if (!m_cmdpool->m_commandListPool.emplace<IGPUCommandPool::CPipelineBarrierCmd>(m_commandList, bufferMemoryBarrierCount, bufferResources, imageMemoryBarrierCount, imageResources))
198+
if (!m_cmdpool->m_commandListPool.emplace<IGPUCommandPool::CPipelineBarrierCmd>(m_commandList, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers))
210199
return false;
211200

212201
pipelineBarrier_impl(srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
@@ -240,14 +229,7 @@ bool IGPUCommandBuffer::bindDescriptorSets(asset::E_PIPELINE_BIND_POINT pipeline
240229
}
241230
}
242231

243-
core::smart_refctd_ptr<const video::IGPUDescriptorSet> descriptorSets_refctd[IGPUPipelineLayout::DESCRIPTOR_SET_COUNT] = { nullptr };
244-
for (auto i = 0; i < descriptorSetCount; ++i)
245-
{
246-
assert(i < IGPUPipelineLayout::DESCRIPTOR_SET_COUNT);
247-
descriptorSets_refctd[i] = core::smart_refctd_ptr<const video::IGPUDescriptorSet>(pDescriptorSets[i]);
248-
}
249-
250-
if (!m_cmdpool->m_commandListPool.emplace<IGPUCommandPool::CBindDescriptorSetsCmd>(m_commandList, core::smart_refctd_ptr<const IGPUPipelineLayout>(layout), descriptorSetCount, descriptorSets_refctd))
232+
if (!m_cmdpool->m_commandListPool.emplace<IGPUCommandPool::CBindDescriptorSetsCmd>(m_commandList, core::smart_refctd_ptr<const IGPUPipelineLayout>(layout), descriptorSetCount, pDescriptorSets))
251233
return false;
252234

253235
for (uint32_t i = 0u; i < descriptorSetCount; ++i)

0 commit comments

Comments
 (0)