diff --git a/cocos/gfx/input-assembler.ts b/cocos/gfx/input-assembler.ts index 3e58ed3dfd..5a5856164e 100644 --- a/cocos/gfx/input-assembler.ts +++ b/cocos/gfx/input-assembler.ts @@ -1,4 +1,4 @@ -import { GFXBuffer, IGFXDrawInfo, IGFXIndirectBuffer } from './buffer'; +import { GFXBuffer, IGFXDrawInfo } from './buffer'; import { GFXFormat, GFXObject, GFXObjectType } from './define'; import { GFXDevice } from './device'; @@ -15,7 +15,6 @@ export interface IGFXInputAssemblerInfo { attributes: IGFXInputAttribute[]; vertexBuffers: GFXBuffer[]; indexBuffer?: GFXBuffer; - isIndirect?: boolean; indirectBuffer?: GFXBuffer; } diff --git a/cocos/gfx/pipeline-state.ts b/cocos/gfx/pipeline-state.ts index b854d4b7e7..524524cbbe 100644 --- a/cocos/gfx/pipeline-state.ts +++ b/cocos/gfx/pipeline-state.ts @@ -1,4 +1,16 @@ -import { GFXBlendFactor, GFXBlendOp, GFXColorMask, GFXComparisonFunc, GFXCullMode, GFXObject, GFXObjectType, GFXPolygonMode, GFXPrimitiveMode, GFXShadeModel, GFXStencilOp } from './define'; +import { + GFXBlendFactor, + GFXBlendOp, + GFXColorMask, + GFXComparisonFunc, + GFXCullMode, + GFXObject, + GFXObjectType, + GFXPolygonMode, + GFXPrimitiveMode, + GFXShadeModel, + GFXStencilOp, +} from './define'; import { GFXDevice } from './device'; import { IGFXInputAttribute } from './input-assembler'; import { GFXPipelineLayout } from './pipeline-layout'; diff --git a/cocos/gfx/webgl/webgl-commands.ts b/cocos/gfx/webgl/webgl-commands.ts index 405a4d97fb..a989e288a0 100644 --- a/cocos/gfx/webgl/webgl-commands.ts +++ b/cocos/gfx/webgl/webgl-commands.ts @@ -1,3 +1,4 @@ +import { CachedArray } from '../../core/memop/cached-array'; import { GFXBufferSource, IGFXDrawInfo, IGFXIndirectBuffer } from '../buffer'; import { GFXBindingType, GFXBufferTextureCopy, GFXBufferUsageBit, GFXColorMask, GFXCullMode, GFXFormat, GFXFormatInfos, GFXFormatSize, GFXLoadOp, GFXMemoryUsageBit, @@ -9,7 +10,6 @@ import { WebGLAttrib, WebGLGPUBindingLayout, WebGLGPUBuffer, WebGLGPUFramebuffer WebGLGPUInput, WebGLGPUInputAssembler, WebGLGPUPipelineState, WebGLGPUShader, WebGLGPUTexture, WebGLGPUUniform, WebGLGPUUniformBlock, WebGLGPUUniformSampler } from './webgl-gpu-objects'; import { IWebGLTexUnit } from './webgl-state-cache'; -import { CachedArray } from '../../core/memop/cached-array'; // tslint:disable: max-line-length @@ -394,7 +394,6 @@ export class WebGLCmdDraw extends WebGLCmdObject { firstInstance: 0, }; - public isIndirect: boolean = false; public gpuIndirectBuffer: WebGLGPUBuffer | null = null; constructor () { @@ -1887,7 +1886,7 @@ export function WebGLCmdFuncExecuteCmds (device: WebGLGFXDevice, cmdPackage: Web case WebGLCmd.DRAW: { const cmd3: WebGLCmdDraw = cmdPackage.drawCmds.array[cmdId]; if (gpuInputAssembler && gpuShader) { - if (!cmd3.isIndirect) { + if (!cmd3.gpuIndirectBuffer) { const drawInfo = cmd3.drawInfo as IGFXDrawInfo; const gpuBuffer = gpuInputAssembler.gpuIndexBuffer; diff --git a/cocos/gfx/webgl/webgl-input-assembler.ts b/cocos/gfx/webgl/webgl-input-assembler.ts index 4551e19ce2..54f1d9facc 100644 --- a/cocos/gfx/webgl/webgl-input-assembler.ts +++ b/cocos/gfx/webgl/webgl-input-assembler.ts @@ -40,10 +40,6 @@ export class WebGLGFXInputAssembler extends GFXInputAssembler { this._vertexCount = vertBuff.size / vertBuff.stride; } - if (info.isIndirect !== undefined) { - this._isIndirect = info.isIndirect; - } - this._gpuInputAssembler = this.webGLDevice.emitCmdCreateGPUInputAssembler(info); this._status = GFXStatus.SUCCESS; @@ -59,8 +55,7 @@ export class WebGLGFXInputAssembler extends GFXInputAssembler { } public extractCmdDraw (cmd: WebGLCmdDraw) { - cmd.isIndirect = this._isIndirect; - if (!this._isIndirect) { + if (!this._indirectBuffer) { cmd.drawInfo.vertexCount = this._vertexCount; cmd.drawInfo.firstVertex = this._firstVertex; cmd.drawInfo.indexCount = this._indexCount; @@ -68,7 +63,7 @@ export class WebGLGFXInputAssembler extends GFXInputAssembler { cmd.drawInfo.vertexOffset = this._vertexOffset; cmd.drawInfo.instanceCount = this._instanceCount; cmd.drawInfo.firstInstance = this._firstInstance; - cmd.isIndirect = this._isIndirect; + cmd.gpuIndirectBuffer = null; } else { cmd.gpuIndirectBuffer = (this._indirectBuffer as WebGLGFXBuffer).gpuBuffer; }