Files
cocos4/cocos/gfx/webgl/webgl-queue.ts
T
Yun Hsiao Wu dd5b097bbd get rid of some critical for-of (#5277)
* fix min joints texture pool size for RGBA8

* get rid of some critical for-of
2019-08-29 05:02:07 -05:00

51 lines
1.4 KiB
TypeScript

import { GFXCommandBuffer } from '../command-buffer';
import { GFXStatus } from '../define';
import { GFXDevice } from '../device';
import { GFXQueue, IGFXQueueInfo } from '../queue';
import { WebGLGFXCommandBuffer } from './webgl-command-buffer';
import { WebGLCmdFuncExecuteCmds } from './webgl-commands';
import { WebGLGFXDevice } from './webgl-device';
export class WebGLGFXQueue extends GFXQueue {
public numDrawCalls: number = 0;
public numTris: number = 0;
private _isAsync: boolean = false;
constructor (device: GFXDevice) {
super(device);
}
public initialize (info: IGFXQueueInfo): boolean {
this._type = info.type;
this._status = GFXStatus.SUCCESS;
return true;
}
public destroy () {
this._status = GFXStatus.UNREADY;
}
public submit (cmdBuffs: GFXCommandBuffer[], fence?) {
// TODO: Async
if (!this._isAsync) {
const len = cmdBuffs.length;
for (let i = 0; i < len; i++) {
const cmdBuff = cmdBuffs[i];
WebGLCmdFuncExecuteCmds( this._device as WebGLGFXDevice, (cmdBuff as WebGLGFXCommandBuffer).cmdPackage);
this.numDrawCalls += cmdBuff.numDrawCalls;
this.numTris += cmdBuff.numTris;
}
}
}
public clear () {
this.numDrawCalls = 0;
this.numTris = 0;
}
}