Skip to content

Commit 3ce1237

Browse files
authored
更新计算 vDataCountLimit 的逻辑
详见 #19104 中的讨论
1 parent 411f98d commit 3ce1237

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cocos/2d/renderer/mesh-buffer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ export class MeshBuffer {
251251

252252
this.floatsPerVertex = getAttributeStride(attrs) >> 2;
253253

254-
var vDataCountLimit = 65536; // 2^16 - 1
254+
let vDataCountLimit = macro.BATCHER2D_MEM_INCREMENT * 256; // 1024 / 4 = 256
255255
const glApi = device.gfxAPI;
256-
if (glApi === API.WEBGPU || glApi === API.WEBGL2 || glApi === API.WEBGL && device.hasFeature(Feature.ELEMENT_INDEX_UINT)) {
257-
vDataCountLimit = 4294967295; // 2^32 - 1
256+
if (glApi !== API.WEBGPU && glApi !== API.WEBGL2 && !(glApi === API.WEBGL && device.hasFeature(Feature.ELEMENT_INDEX_UINT))) {
257+
vDataCountLimit = Math.min(vDataCountLimit, 65536);
258258
}
259259
assertIsTrue(this._initVDataCount / this._floatsPerVertex < vDataCountLimit, getError(9005));
260260

0 commit comments

Comments
 (0)