diff --git a/cocos/gfx/webgl/webgl-command-allocator.ts b/cocos/gfx/webgl/webgl-command-allocator.ts index ce05a34e62..4f2e4008c5 100644 --- a/cocos/gfx/webgl/webgl-command-allocator.ts +++ b/cocos/gfx/webgl/webgl-command-allocator.ts @@ -27,10 +27,9 @@ export class WebGLGFXCommandPool { public alloc (clazz: new() => T): T { if (this._count >= this._data.length) { - if (this._data.length * 2 > this._data.length) { - for (let i = this._data.length; i < this._data.length * 2; ++i) { - this._data[i] = new clazz(); - } + const size = this._data.length * 2; + for (let i = this._data.length; i < size; ++i) { + this._data[i] = new clazz(); } }