Files
cocos4/cocos/core/gfx/webgl2/webgl2-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

45 lines
1.3 KiB
TypeScript

import { GFXCommandBuffer } from '../command-buffer';
import { GFXQueue, GFXQueueInfo } from '../queue';
import { WebGL2CommandBuffer } from './webgl2-command-buffer';
import { GFXFence } from '../fence';
import { WebGL2Fence } from './webgl2-fence';
export class WebGL2Queue 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) {
// TODO: Async
if (!this._isAsync) {
for (let i = 0; i < cmdBuffs.length; i++) {
const cmdBuff = cmdBuffs[i] as WebGL2CommandBuffer;
// WebGL2CmdFuncExecuteCmds(this._device as WebGL2Device, cmdBuff.cmdPackage); // opted out
this.numDrawCalls += cmdBuff.numDrawCalls;
this.numInstances += cmdBuff.numInstances;
this.numTris += cmdBuff.numTris;
}
}
if (fence) {
(fence as WebGL2Fence).insert();
}
}
public clear () {
this.numDrawCalls = 0;
this.numInstances = 0;
this.numTris = 0;
}
}