mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 10:32:39 +08:00
c2e3de2caa
* 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
45 lines
1.3 KiB
TypeScript
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;
|
|
}
|
|
}
|