mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 16:52:43 +08:00
9f89b0ef24
* Temp * temp * move ui core * Arrange ui and terrain * Fix import path for all modules except core * Move primitives into core * Fix debug.getError * Move audio-downloader to audio module * export game from game.ts * Migrate load-pipeline to ts * Fix core modules and cleanup * Move animation into core * Fix module exports * Fix director issue * Remove most cc.director usage * Fix ts issues * Fix issues for unit test and editor running * Revert removing deprecated import * tweaks * tweaks * Fix ci * Fix ci * Add modules in module division * Upgrade coordinates-converts-utils
51 lines
1.4 KiB
TypeScript
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;
|
|
}
|
|
}
|