1. 程式人生 > 其它 >creator gfx 各個類的原始碼解讀(5) WebGL2CommandAllocator

creator gfx 各個類的原始碼解讀(5) WebGL2CommandAllocator

gfx 各個類的原始碼解讀(5) WebGL2CommandAllocator
WebGL2CommandAllocator 在 webgl2-command-allocator.ts
  WebGL2CommandPool(見下文) 快取(回收的)各種WebGL2CmdObject物件
成員變數:

//以下分別對應WebGL2Cmd子類的pool

    public beginRenderPassCmdPool: WebGL2CommandPool<WebGL2CmdBeginRenderPass>;
    public bindStatesCmdPool: WebGL2CommandPool<WebGL2CmdBindStates>;
    public drawCmdPool: WebGL2CommandPool<WebGL2CmdDraw>;
    public updateBufferCmdPool: WebGL2CommandPool<WebGL2CmdUpdateBuffer>;
    public copyBufferToTextureCmdPool: WebGL2CommandPool<WebGL2CmdCopyBufferToTexture>;

成員函式:

clearCmds (cmdPackage: WebGL2CmdPackage)
  pool回收WebGL2CmdPackage裡的各種WebGL2CmdObject物件

releaseCmds
  釋放Pool裡的快取物件

WebGL2CommandPool類

  分配和回收快取一種WebGL2CmdObject子類物件

成員函式:
alloc
  建立WebGL2CmdObject子類物件

free (cmd: T)
freeCmds (cmds: CachedArray)
  回收一個或多個WebGL2CmdObject子類物件

release()
  釋放pool,釋放WebGL2CmdObject子類物件