mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 07:26:48 +01:00
Delicious words
- Check against totalAvailable in StagingBuffer#reserveForCopy - Fixes garbage being rendered after uploading large amounts of data
This commit is contained in:
parent
dfca589c5b
commit
08476b5779
1 changed files with 5 additions and 2 deletions
|
@ -164,9 +164,8 @@ public class StagingBuffer {
|
||||||
*/
|
*/
|
||||||
public long reserveForCopy(long size, int dstVbo, long dstOffset) {
|
public long reserveForCopy(long size, int dstVbo, long dstOffset) {
|
||||||
assertMultipleOf4(size);
|
assertMultipleOf4(size);
|
||||||
// Don't need to check totalAvailable here because that's a looser constraint than the bytes remaining.
|
|
||||||
long remaining = capacity - pos;
|
long remaining = capacity - pos;
|
||||||
if (size > remaining) {
|
if (size > remaining || size > totalAvailable) {
|
||||||
return MemoryUtil.NULL;
|
return MemoryUtil.NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,6 +235,10 @@ public class StagingBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pushTransfer(int dstVbo, long srcOffset, long dstOffset, long size) {
|
private void pushTransfer(int dstVbo, long srcOffset, long dstOffset, long size) {
|
||||||
|
if (totalAvailable < size) {
|
||||||
|
throw new IllegalStateException("Not enough available space to transfer");
|
||||||
|
}
|
||||||
|
|
||||||
transfers.push(dstVbo, srcOffset, dstOffset, size);
|
transfers.push(dstVbo, srcOffset, dstOffset, size);
|
||||||
usedCapacity += size;
|
usedCapacity += size;
|
||||||
totalAvailable -= size;
|
totalAvailable -= size;
|
||||||
|
|
Loading…
Reference in a new issue