Revert "Return the actual block capacity from GrBufferAllocPool::makeSpaceAtLeast"

This reverts commit d10f080fa8.

Reason for revert: Possible failures on roll

Original change's description:
> Return the actual block capacity from GrBufferAllocPool::makeSpaceAtLeast
> 
> It looks like this was changed to return the fallback size instead of
> the block capacity for the sake of GrTextureOp, but GrTextureOp does
> not call makeSpaceAtLeast() anymore.
> 
> For ops that write their vertex data in chunks, it's best to know the
> full capacity of the block. This way they can maximize the amount of
> data written out per chunk.
> 
> Bug: skia:10419
> Change-Id: I7d3f74cdfc7d9b89f9d331e09069f8d178c07d81
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300396
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com

Change-Id: Idb315fd68bcb585dcf5017872c0ffb7d0a52214c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10419
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300850
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2020-07-07 07:16:52 +00:00 committed by Skia Commit-Bot
parent 9f57f0ec93
commit 95dfda4eca

View File

@ -261,8 +261,15 @@ void* GrBufferAllocPool::makeSpaceAtLeast(size_t minSize,
back.fBytesFree -= pad;
fBytesInUse += pad;
// Give caller all remaining space in this block (but aligned correctly)
size_t size = align_down(back.fBytesFree, alignment);
// Give caller all remaining space in this block up to fallbackSize (but aligned
// correctly)
size_t size;
if (back.fBytesFree >= fallbackSize) {
SkASSERT(align_down(fallbackSize, alignment) == fallbackSize);
size = fallbackSize;
} else {
size = align_down(back.fBytesFree, alignment);
}
*offset = usedBytes;
*buffer = back.fBuffer;
*actualSize = size;