Files
cocos4/cocos/core/gfx/webgl/webgl-queue.ts
T
Yun Hsiao Wu c2e3de2caa GFX: public interfaces (#7444)
* public interfaces: render pass, IA, PSO

* public interfaces: Queue, Sampler, Shader, DSLayout

* public interfaces: DS, CB, Texture, Buffer, Device

* public interfaces: other supporting structs

* fix framebuffer state cache
2020-09-28 11:32:47 +08:00

40 lines
1.1 KiB
TypeScript

import { GFXCommandBuffer } from '../command-buffer';
import { GFXQueue, GFXQueueInfo } from '../queue';
import { GFXFence } from '../fence';
export class WebGLQueue extends GFXQueue {
public numDrawCalls: number = 0;
public numInstances: number = 0;
public numTris: number = 0;
public initialize (info: GFXQueueInfo): boolean {
this._type = info.type;
return true;
}
public destroy () {
}
public submit (cmdBuffs: GFXCommandBuffer[], fence?: GFXFence) {
if (!this._isAsync) {
const len = cmdBuffs.length;
for (let i = 0; i < len; i++) {
const cmdBuff = cmdBuffs[i];
// WebGLCmdFuncExecuteCmds( this._device as WebGLDevice, (cmdBuff as WebGLCommandBuffer).cmdPackage); // opted out
this.numDrawCalls += cmdBuff.numDrawCalls;
this.numInstances += cmdBuff.numInstances;
this.numTris += cmdBuff.numTris;
}
}
}
public clear () {
this.numDrawCalls = 0;
this.numInstances = 0;
this.numTris = 0;
}
}