diff --git a/src/gpu/ganesh/ops/DrawMeshOp.cpp b/src/gpu/ganesh/ops/DrawMeshOp.cpp index fa35a6d72a6600c87ee22ece089c4c631de78ede..f4af710a6319da9f8336fd35a4a30f31416bd5fe 100644 --- a/src/gpu/ganesh/ops/DrawMeshOp.cpp +++ b/src/gpu/ganesh/ops/DrawMeshOp.cpp @@ -1006,7 +1006,11 @@ GrOp::CombineResult MeshOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const Gr if (SkToBool(fIndexCount) != SkToBool(that->fIndexCount)) { return CombineResult::kCannotCombine; } - if (SkToBool(fIndexCount) && fVertexCount > UINT16_MAX - that->fVertexCount) { + if (SkToBool(fIndexCount) && + // Index count would overflow + (fIndexCount > INT32_MAX - that->fIndexCount || + // *or* combined vertex count would not be referenceable by uint16 indices + fVertexCount > SkToInt(UINT16_MAX) - that->fVertexCount)) { return CombineResult::kCannotCombine; }