mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2025-01-11 09:00:08 +00:00
Merge pull request #957 from barfowl/reserve_overflow_bugs
Fixed integer overflow bugs for large meshes in PatchTable factories
This commit is contained in:
commit
dc4948fa75
@ -67,7 +67,7 @@ EndCapBSplineBasisPatchFactory::EndCapBSplineBasisPatchFactory(
|
||||
// we typically use 7 patch points for each bspline endcap.
|
||||
int numPatchPointsExpected = numMaxLevelFaces * 7;
|
||||
// limits to 100M (=800M bytes) entries for the reserved size.
|
||||
int numStencilsExpected = std::min(numPatchPointsExpected * 16,
|
||||
int numStencilsExpected = (int) std::min<long>((long)numPatchPointsExpected * 16,
|
||||
100*1024*1024);
|
||||
_vertexStencils->reserve(numPatchPointsExpected, numStencilsExpected);
|
||||
if (_varyingStencils) {
|
||||
|
@ -60,7 +60,7 @@ EndCapGregoryBasisPatchFactory::EndCapGregoryBasisPatchFactory(
|
||||
|
||||
int numPatchPointsExpected = numMaxLevelFaces * 20;
|
||||
// limits to 100M (=800M bytes) entries for the reserved size.
|
||||
int numStencilsExpected = std::min(numPatchPointsExpected * 16,
|
||||
int numStencilsExpected = (int) std::min<long>((long)numPatchPointsExpected * 16,
|
||||
100*1024*1024);
|
||||
_vertexStencils->reserve(numPatchPointsExpected, numStencilsExpected);
|
||||
if (_varyingStencils) {
|
||||
|
@ -148,7 +148,7 @@ EndCapLegacyGregoryPatchFactory::Finalize(
|
||||
const int SizePerVertex = 2*maxValence + 1;
|
||||
|
||||
PatchTable::VertexValenceTable & vTable = (*vertexValenceTable);
|
||||
vTable.resize(_refiner.GetNumVerticesTotal() * SizePerVertex);
|
||||
vTable.resize((long)_refiner.GetNumVerticesTotal() * SizePerVertex);
|
||||
|
||||
int vOffset = 0;
|
||||
int levelLast = _refiner.GetMaxLevel();
|
||||
@ -158,7 +158,7 @@ EndCapLegacyGregoryPatchFactory::Finalize(
|
||||
|
||||
if (i == levelLast) {
|
||||
|
||||
int vTableOffset = vOffset * SizePerVertex;
|
||||
long vTableOffset = vOffset * SizePerVertex;
|
||||
|
||||
for (int vIndex = 0; vIndex < level->getNumVertices(); ++vIndex) {
|
||||
int* vTableEntry = &vTable[vTableOffset];
|
||||
|
Loading…
Reference in New Issue
Block a user