StagingBuffer: Large slots should be aligned to alignment
Slots whose stride size is larger than the slot alignment value should have their size rounded up to the alignment size so that the slots that follow them will also be aligned.
This commit is contained in:
@@ -68,10 +68,13 @@ static size_t calculateMaxAlignment(
|
||||
|
||||
void StagingBuffer::computeSlotStrideAndBufferSize()
|
||||
{
|
||||
// Slot stride is the maximum of alignment and padding
|
||||
slotStrideNBytes = std::max(
|
||||
// Slot stride is the maximum of alignment and padding, rounded up to a multiple of alignment
|
||||
size_t minSlotStride = std::max(
|
||||
inputConstraints.slotStartAlignmentByteVal,
|
||||
inputConstraints.slotPadToNBytes);
|
||||
slotStrideNBytes = ((minSlotStride + inputConstraints.slotStartAlignmentByteVal - 1)
|
||||
/ inputConstraints.slotStartAlignmentByteVal)
|
||||
* inputConstraints.slotStartAlignmentByteVal;
|
||||
|
||||
// Calculate maximum alignment needed for first slot (must satisfy both frame and slot alignment)
|
||||
size_t maxAlignment = calculateMaxAlignment(
|
||||
|
||||
Reference in New Issue
Block a user