Bug 1306628 - Handle large sizes in GrResourceProvider::createBuffer. r=mchang

MozReview-Commit-ID: 3ZGDmIum5OU

--HG--
extra : rebase_source : 01be35ac1a6b192c4a7e30e022b3d692ad82138d
This commit is contained in:
Lee Salzman 2016-10-25 00:31:43 -04:00
Родитель 3f830565b0
Коммит 0e267ba5b2
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -109,8 +109,11 @@ GrBuffer* GrResourceProvider::createBuffer(size_t size, GrBufferType intendedTyp
}
// bin by pow2 with a reasonable min
static const uint32_t MIN_SIZE = 1 << 12;
size_t allocSize = SkTMax(MIN_SIZE, GrNextPow2(SkToUInt(size)));
static const size_t MIN_SIZE = 1 << 12;
size_t allocSize = size > (1u << 31)
? size_t(SkTMin(uint64_t(SIZE_MAX), uint64_t(GrNextPow2(uint32_t(uint64_t(size) >> 32))) << 32))
: size_t(GrNextPow2(uint32_t(size)));
allocSize = SkTMax(allocSize, MIN_SIZE);
GrScratchKey key;
GrBuffer::ComputeScratchKeyForDynamicVBO(allocSize, intendedType, &key);