Skip to content

Commit 61604ee

Browse files
committed
More PR reviws
1 parent 99d80a7 commit 61604ee

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

include/nbl/video/utilities/IPropertyPool.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class NBL_API2 IPropertyPool : public core::IReferenceCounted
2626
using PropertyAddressAllocator = core::PoolAddressAllocatorST<uint32_t>;
2727

2828
static inline constexpr uint64_t invalid = 0;
29+
using value_type = PropertyAddressAllocator::size_type;
2930
//
3031
virtual const asset::SBufferRange<IGPUBuffer>& getPropertyMemoryBlock(uint32_t ix) const =0;
3132

@@ -37,19 +38,19 @@ class NBL_API2 IPropertyPool : public core::IReferenceCounted
3738
inline bool isContiguous() const {return m_indexToAddr;}
3839

3940
//
40-
inline uint64_t getAllocated() const
41+
inline value_type getAllocated() const
4142
{
4243
return indexAllocator.get_allocated_size();
4344
}
4445

4546
//
46-
inline uint64_t getFree() const
47+
inline value_type getFree() const
4748
{
4849
return indexAllocator.get_free_size();
4950
}
5051

5152
//
52-
inline uint64_t getCapacity() const
53+
inline value_type getCapacity() const
5354
{
5455
// special case allows us to use `get_total_size`, because the pool allocator has no added offsets
5556
return indexAllocator.get_total_size();

src/nbl/video/utilities/CPropertyPoolHandler.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,28 @@ bool CPropertyPoolHandler::transferProperties(
138138
transferRequest.fill = 0; // TODO
139139
transferRequest.srcIndexSizeLog2 = 1u; // TODO
140140
transferRequest.dstIndexSizeLog2 = 1u; // TODO
141-
assert(getAlignment(transferRequest.srcAddr) == 0);
142-
assert(getAlignment(transferRequest.dstAddr) == 0);
141+
if (getAlignment(transferRequest.srcAddr) != 0)
142+
{
143+
logger.log("CPropertyPoolHandler: memblock.buffer BDA address %I64i is not aligned to 8 byte (64 bit)",system::ILogger::ELL_ERROR, transferRequest.srcAddr);
144+
}
145+
if (getAlignment(transferRequest.dstAddr) != 0)
146+
{
147+
logger.log("CPropertyPoolHandler: buffer.buffer BDA address %I64i is not aligned to 8 byte (64 bit)",system::ILogger::ELL_ERROR, transferRequest.dstAddr);
148+
}
149+
if (getAlignment(transferRequest.propertySize) != 0)
150+
{
151+
logger.log("CPropertyPoolHandler: propertySize %i is not aligned to 8 byte (64 bit)",system::ILogger::ELL_ERROR, srcRequest->elementSize);
152+
}
153+
if (transferRequest.srcIndexSizeLog2 < 1 || transferRequest.srcIndexSizeLog2 > 3)
154+
{
155+
auto srcIndexSizeLog2 = transferRequest.srcIndexSizeLog2;
156+
logger.log("CPropertyPoolHandler: srcIndexSizeLog2 %i (%i bit values) are unsupported",system::ILogger::ELL_ERROR, srcIndexSizeLog2, (1 << transferRequest.srcIndexSizeLog2) * sizeof(uint8_t));
157+
}
158+
if (transferRequest.dstIndexSizeLog2 < 1 || transferRequest.dstIndexSizeLog2 > 3)
159+
{
160+
auto dstIndexSizeLog2 = transferRequest.dstIndexSizeLog2;
161+
logger.log("CPropertyPoolHandler: dstIndexSizeLog2 %i (%i bit values) are unsupported",system::ILogger::ELL_ERROR, dstIndexSizeLog2, (1 << transferRequest.srcIndexSizeLog2) * sizeof(uint8_t));
162+
}
143163

144164
maxElements = core::max<uint64_t>(maxElements, srcRequest->elementCount);
145165
}
@@ -163,7 +183,7 @@ bool CPropertyPoolHandler::transferProperties(
163183
// TODO: Should the offset bytes be handled elsewhere?
164184
pushConstants.beginOffset = baseOffsetBytes;
165185
pushConstants.endOffset = endOffsetBytes;
166-
pushConstants.transferCommandsAddress = scratchBufferDeviceAddr;
186+
pushConstants.transferCommandsAddress = scratchBufferDeviceAddr + transferPassRequestsIndex * sizeof(TransferRequest);
167187
}
168188
assert(getAlignment(scratchBufferDeviceAddr) == 0);
169189
assert(getAlignment(sizeof(TransferRequest)) == 0);

0 commit comments

Comments
 (0)