mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 11:02:40 +08:00
dfc3d141f2
* gfx: descriptor sets * gfx: descriptor set, singular * better structure * adapt upper layers: first pass finally all compiler errors cleared. OKAY IT'S HAPPENING EVERYBODY STAY THE ****ING CALM * adapt upper layers: second pass THERE AND BACK AGAIN * unified light pass & shadow shader * gfx: descriptor set & pipeline layout * light pass: better structure * light pass: dynamic uniform * even more type checking for memory pools * Fix particleSystem and lineComponent. * delete comment * guard pool init param * Fix trail module error. * delete space * light pass: instancing & batching support * don't polyfill gfx stuff inside EffectAsset * better light pass structure * fix spot light culling Co-authored-by: caryliu <caryliu1999@gmail.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { GFXCommandBuffer } from '../command-buffer';
|
|
import { GFXQueue, IGFXQueueInfo } 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: IGFXQueueInfo): 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;
|
|
}
|
|
}
|