command buffer interface update (#6991)

This commit is contained in:
Yun Hsiao Wu
2020-07-17 13:55:58 +08:00
committed by GitHub
parent cd59c4dbf3
commit a0d4480f55
21 changed files with 99 additions and 138 deletions
+11
View File
@@ -5,6 +5,7 @@
import { removeProperty, replaceProperty } from '../utils';
import { Mesh } from './mesh';
import { TextureBase } from './texture-base';
import { RenderTexture } from './render-texture';
replaceProperty(Mesh.prototype, 'Mesh.prototype', [
{
@@ -33,3 +34,13 @@ removeProperty(TextureBase.prototype, 'TextureBase.prototype', [
name: 'setFlipY',
},
]);
replaceProperty(RenderTexture.prototype, 'RenderTexture.prototype', [
{
name: 'getGFXWindow',
customFunction () {
// @ts-ignore
return this._window;
},
},
]);
+1 -1
View File
@@ -105,7 +105,7 @@ export class SimpleTexture extends TextureBase {
* @param arrayIndex 数组索引。
*/
public uploadData (source: HTMLCanvasElement | HTMLImageElement | ArrayBufferView, level: number = 0, arrayIndex: number = 0) {
if (!this._gfxTexture || this._gfxTexture.mipLevel <= level) {
if (!this._gfxTexture || this._gfxTexture.levelCount <= level) {
return;
}
+1 -1
View File
@@ -259,7 +259,7 @@ export abstract class GFXCommandBuffer extends GFXObject {
* @param dstLayout The target texture layout.
* @param regions The region descriptions.
*/
public abstract copyBufferToTexture (srcBuff: GFXBuffer, dstTex: GFXTexture, dstLayout: GFXTextureLayout, regions: GFXBufferTextureCopy[]): void;
public abstract copyBuffersToTexture (buffers: ArrayBufferView[], texture: GFXTexture, regions: GFXBufferTextureCopy[]): void;
/**
* @en Execute specified command buffers.
-1
View File
@@ -9,7 +9,6 @@ import { GFXFence } from './fence';
export interface IGFXQueueInfo {
type: GFXQueueType;
forceSync?: boolean;
}
/**
+6 -6
View File
@@ -100,16 +100,16 @@ export abstract class GFXTexture extends GFXObject {
* @en Get texture array layer.
* @zh 纹理数组层数。
*/
get arrayLayer (): number {
return this._arrayLayer;
get layerCount (): number {
return this._layerCount;
}
/**
* @en Get texture mip level.
* @zh 纹理 mip 层级数。
*/
get mipLevel (): number {
return this._mipLevel;
get levelCount (): number {
return this._levelCount;
}
/**
@@ -158,9 +158,9 @@ export abstract class GFXTexture extends GFXObject {
protected _depth: number = 1;
protected _arrayLayer: number = 1;
protected _layerCount: number = 1;
protected _mipLevel: number = 1;
protected _levelCount: number = 1;
protected _samples: GFXSampleCount = GFXSampleCount.X1;
+4 -10
View File
@@ -401,23 +401,17 @@ export class WebGLGFXCommandBuffer extends GFXCommandBuffer {
}
}
public copyBufferToTexture (
srcBuff: GFXBuffer,
dstTex: GFXTexture,
dstLayout: GFXTextureLayout,
regions: GFXBufferTextureCopy[]) {
public copyBuffersToTexture (buffers: ArrayBufferView[], texture: GFXTexture, regions: GFXBufferTextureCopy[]) {
if (this._type === GFXCommandBufferType.PRIMARY && !this._isInRenderPass ||
this._type === GFXCommandBufferType.SECONDARY) {
const gpuBuffer = ( srcBuff as WebGLGFXBuffer).gpuBuffer;
const gpuTexture = ( dstTex as WebGLGFXTexture).gpuTexture;
if (gpuBuffer && gpuTexture) {
const gpuTexture = (texture as WebGLGFXTexture).gpuTexture;
if (gpuTexture) {
const cmd = this._webGLAllocator!.copyBufferToTextureCmdPool.alloc(WebGLCmdCopyBufferToTexture);
if (cmd) {
cmd.gpuBuffer = gpuBuffer;
cmd.gpuTexture = gpuTexture;
cmd.dstLayout = dstLayout;
cmd.regions = regions;
cmd.buffers = buffers;
this.cmdPackage.copyBufferToTextureCmds.push(cmd);
this.cmdPackage.cmds.push(WebGLCmd.COPY_BUFFER_TO_TEXTURE);
+3 -5
View File
@@ -618,9 +618,8 @@ export class WebGLGFXBufferTextureCopy {
export class WebGLCmdCopyBufferToTexture extends WebGLCmdObject {
public gpuBuffer: WebGLGPUBuffer | null = null;
public gpuTexture: WebGLGPUTexture | null = null;
public dstLayout: GFXTextureLayout | null = null;
public buffers: ArrayBufferView[] = [];
public regions: GFXBufferTextureCopy[] = [];
constructor () {
@@ -628,9 +627,8 @@ export class WebGLCmdCopyBufferToTexture extends WebGLCmdObject {
}
public clear () {
this.gpuBuffer = null;
this.gpuTexture = null;
this.dstLayout = null;
this.buffers.length = 0;
this.regions.length = 0;
}
}
@@ -2704,7 +2702,7 @@ export function WebGLCmdFuncExecuteCmds (device: WebGLGFXDevice, cmdPackage: Web
}
case WebGLCmd.COPY_BUFFER_TO_TEXTURE: {
const cmd5 = cmdPackage.copyBufferToTextureCmds.array[cmdId];
WebGLCmdFuncCopyBuffersToTexture(device, [(cmd5.gpuBuffer as WebGLGPUBuffer).buffer!], cmd5.gpuTexture as WebGLGPUTexture, cmd5.regions);
WebGLCmdFuncCopyBuffersToTexture(device, cmd5.buffers, cmd5.gpuTexture as WebGLGPUTexture, cmd5.regions);
break;
}
} // switch
@@ -15,8 +15,6 @@ import { WebGLGFXTexture } from './webgl-texture';
import { GFXRenderPass } from '../render-pass';
import { WebGLGFXRenderPass } from './webgl-render-pass';
const _buffers: ArrayBufferView[] = [];
export class WebGLGFXPrimaryCommandBuffer extends WebGLGFXCommandBuffer {
public beginRenderPass (
@@ -87,18 +85,12 @@ export class WebGLGFXPrimaryCommandBuffer extends WebGLGFXCommandBuffer {
}
}
public copyBufferToTexture (
srcBuff: GFXBuffer,
dstTex: GFXTexture,
dstLayout: GFXTextureLayout,
regions: GFXBufferTextureCopy[]) {
public copyBuffersToTexture (buffers: ArrayBufferView[], texture: GFXTexture, regions: GFXBufferTextureCopy[]) {
if (!this._isInRenderPass) {
const gpuBuffer = (srcBuff as WebGLGFXBuffer).gpuBuffer;
const gpuTexture = (dstTex as WebGLGFXTexture).gpuTexture;
if (gpuBuffer && gpuTexture) {
_buffers[0] = gpuBuffer.buffer!;
WebGLCmdFuncCopyBuffersToTexture(this._device as WebGLGFXDevice, _buffers, gpuTexture, regions);
const gpuTexture = (texture as WebGLGFXTexture).gpuTexture;
if (gpuTexture) {
WebGLCmdFuncCopyBuffersToTexture(this._device as WebGLGFXDevice, buffers, gpuTexture, regions);
}
} else {
console.error('Command \'copyBufferToTexture\' must be recorded outside a render pass.');
+6 -6
View File
@@ -30,11 +30,11 @@ export class WebGLGFXTexture extends GFXTexture {
}
if (info.arrayLayer !== undefined) {
this._arrayLayer = info.arrayLayer;
this._layerCount = info.arrayLayer;
}
if (info.mipLevel !== undefined) {
this._mipLevel = info.mipLevel;
this._levelCount = info.mipLevel;
}
if (info.samples !== undefined) {
@@ -48,7 +48,7 @@ export class WebGLGFXTexture extends GFXTexture {
this._isPowerOf2 = IsPowerOf2(this._width) && IsPowerOf2(this._height);
this._size = GFXFormatSurfaceSize(this._format, this.width, this.height,
this.depth, this.mipLevel) * this._arrayLayer;
this.depth, this._levelCount) * this._layerCount;
if (this._flags & GFXTextureFlagBit.BAKUP_BUFFER) {
this._buffer = new ArrayBuffer(this._size);
@@ -62,8 +62,8 @@ export class WebGLGFXTexture extends GFXTexture {
height: this._height,
depth: this._depth,
size: this._size,
arrayLayer: this._arrayLayer,
mipLevel: this._mipLevel,
arrayLayer: this._layerCount,
mipLevel: this._levelCount,
samples: this._samples,
flags: this._flags,
isPowerOf2: this._isPowerOf2,
@@ -105,7 +105,7 @@ export class WebGLGFXTexture extends GFXTexture {
this._width = width;
this._height = height;
this._size = GFXFormatSurfaceSize(this._format, this.width, this.height,
this.depth, this.mipLevel) * this._arrayLayer;
this.depth, this._levelCount) * this._layerCount;
if (this._gpuTexture) {
this._gpuTexture.width = width;
+4 -10
View File
@@ -397,21 +397,15 @@ export class WebGL2GFXCommandBuffer extends GFXCommandBuffer {
}
}
public copyBufferToTexture (
srcBuff: GFXBuffer,
dstTex: GFXTexture,
dstLayout: GFXTextureLayout,
regions: GFXBufferTextureCopy[]) {
public copyBuffersToTexture (buffers: ArrayBufferView[], texture: GFXTexture, regions: GFXBufferTextureCopy[]) {
if (this._type === GFXCommandBufferType.PRIMARY && !this._isInRenderPass ||
this._type === GFXCommandBufferType.SECONDARY) {
const gpuBuffer = ( srcBuff as WebGL2GFXBuffer).gpuBuffer;
const gpuTexture = ( dstTex as WebGL2GFXTexture).gpuTexture;
if (gpuBuffer && gpuTexture) {
const gpuTexture = (texture as WebGL2GFXTexture).gpuTexture;
if (gpuTexture) {
const cmd = this._webGLAllocator!.copyBufferToTextureCmdPool.alloc(WebGL2CmdCopyBufferToTexture);
cmd.gpuBuffer = gpuBuffer;
cmd.gpuTexture = gpuTexture;
cmd.dstLayout = dstLayout;
cmd.buffers = buffers;
cmd.regions = regions;
this.cmdPackage.copyBufferToTextureCmds.push(cmd);
+3 -5
View File
@@ -769,9 +769,8 @@ export class WebGL2GFXBufferTextureCopy {
export class WebGL2CmdCopyBufferToTexture extends WebGL2CmdObject {
public gpuBuffer: WebGL2GPUBuffer | null = null;
public gpuTexture: WebGL2GPUTexture | null = null;
public dstLayout: GFXTextureLayout | null = null;
public buffers: ArrayBufferView[] = [];
public regions: GFXBufferTextureCopy[] = [];
constructor () {
@@ -779,9 +778,8 @@ export class WebGL2CmdCopyBufferToTexture extends WebGL2CmdObject {
}
public clear () {
this.gpuBuffer = null;
this.gpuTexture = null;
this.dstLayout = null;
this.buffers.length = 0;
this.regions.length = 0;
}
}
@@ -2741,7 +2739,7 @@ export function WebGL2CmdFuncExecuteCmds (device: WebGL2GFXDevice, cmdPackage: W
}
case WebGL2Cmd.COPY_BUFFER_TO_TEXTURE: {
const cmd5 = cmdPackage.copyBufferToTextureCmds.array[cmdId];
WebGL2CmdFuncCopyBuffersToTexture(device, [(cmd5.gpuBuffer as WebGL2GPUBuffer).buffer!], cmd5.gpuTexture as WebGL2GPUTexture, cmd5.regions);
WebGL2CmdFuncCopyBuffersToTexture(device, cmd5.buffers, cmd5.gpuTexture as WebGL2GPUTexture, cmd5.regions);
break;
}
} // switch
@@ -15,8 +15,6 @@ import { WebGL2GFXTexture } from './webgl2-texture';
import { GFXRenderPass } from '../render-pass';
import { WebGL2GFXRenderPass } from './webgl2-render-pass';
const _buffers: ArrayBufferView[] = [];
export class WebGL2GFXPrimaryCommandBuffer extends WebGL2GFXCommandBuffer {
public beginRenderPass (
@@ -87,18 +85,11 @@ export class WebGL2GFXPrimaryCommandBuffer extends WebGL2GFXCommandBuffer {
}
}
public copyBufferToTexture (
srcBuff: GFXBuffer,
dstTex: GFXTexture,
dstLayout: GFXTextureLayout,
regions: GFXBufferTextureCopy[]) {
public copyBuffersToTexture (buffers: ArrayBufferView[], texture: GFXTexture, regions: GFXBufferTextureCopy[]) {
if (!this._isInRenderPass) {
const gpuBuffer = (srcBuff as WebGL2GFXBuffer).gpuBuffer;
const gpuTexture = (dstTex as WebGL2GFXTexture).gpuTexture;
if (gpuBuffer && gpuTexture) {
_buffers[0] = gpuBuffer.buffer!;
WebGL2CmdFuncCopyBuffersToTexture(this._device as WebGL2GFXDevice, _buffers, gpuTexture, regions);
const gpuTexture = (texture as WebGL2GFXTexture).gpuTexture;
if (gpuTexture) {
WebGL2CmdFuncCopyBuffersToTexture(this._device as WebGL2GFXDevice, buffers, gpuTexture, regions);
}
} else {
console.error('Command \'copyBufferToTexture\' must be recorded outside a render pass.');
+6 -6
View File
@@ -30,11 +30,11 @@ export class WebGL2GFXTexture extends GFXTexture {
}
if (info.arrayLayer !== undefined) {
this._arrayLayer = info.arrayLayer;
this._layerCount = info.arrayLayer;
}
if (info.mipLevel !== undefined) {
this._mipLevel = info.mipLevel;
this._levelCount = info.mipLevel;
}
if (info.samples !== undefined) {
@@ -48,7 +48,7 @@ export class WebGL2GFXTexture extends GFXTexture {
this._isPowerOf2 = IsPowerOf2(this._width) && IsPowerOf2(this._height);
this._size = GFXFormatSurfaceSize(this._format, this.width, this.height,
this.depth, this.mipLevel) * this._arrayLayer;
this.depth, this._levelCount) * this._layerCount;
if (this._flags & GFXTextureFlagBit.BAKUP_BUFFER) {
this._buffer = new ArrayBuffer(this._size);
@@ -62,8 +62,8 @@ export class WebGL2GFXTexture extends GFXTexture {
height: this._height,
depth: this._depth,
size: this._size,
arrayLayer: this._arrayLayer,
mipLevel: this._mipLevel,
arrayLayer: this._layerCount,
mipLevel: this._levelCount,
samples: this._samples,
flags: this._flags,
isPowerOf2: this._isPowerOf2,
@@ -105,7 +105,7 @@ export class WebGL2GFXTexture extends GFXTexture {
this._width = width;
this._height = height;
this._size = GFXFormatSurfaceSize(this._format, this.width, this.height,
this.depth, this.mipLevel) * this._arrayLayer;
this.depth, this._levelCount) * this._layerCount;
if (this._gpuTexture) {
this._gpuTexture.width = width;
+2 -8
View File
@@ -55,14 +55,9 @@ export class ForwardStage extends RenderStage {
public activate (flow: RenderFlow) {
super.activate(flow);
this.createCmdBuffer();
}
public destroy () {
if (this._cmdBuff) {
this._cmdBuff.destroy();
this._cmdBuff = null;
}
}
public resize (width: number, height: number) {
@@ -124,7 +119,7 @@ export class ForwardStage extends RenderStage {
const camera = view.camera;
const cmdBuff = this._cmdBuff!;
const cmdBuff = this._pipeline.commandBuffers[0];
const vp = camera.viewport;
this._renderArea!.x = vp.x * camera.width;
@@ -174,8 +169,7 @@ export class ForwardStage extends RenderStage {
cmdBuff.endRenderPass();
cmdBuff.end();
bufs[0] = cmdBuff;
device.queue.submit(bufs);
device.queue.submit(this._pipeline.commandBuffers);
if (this._pipeline.useMSAA) {
device.blitFramebuffer(
+1 -12
View File
@@ -35,16 +35,10 @@ export class ToneMapStage extends RenderStage {
super.activate(flow);
this.createCmdBuffer();
this.rebuild();
}
public destroy () {
if (this._cmdBuff) {
this._cmdBuff.destroy();
this._cmdBuff = null;
}
}
public resize (width: number, height: number) {
@@ -74,7 +68,7 @@ export class ToneMapStage extends RenderStage {
public render (view: RenderView) {
const camera = view.camera!;
const cmdBuff = this._cmdBuff!;
const cmdBuff = this._pipeline.commandBuffers[0];
this._renderArea!.width = camera.width;
this._renderArea!.height = camera.height;
@@ -82,7 +76,6 @@ export class ToneMapStage extends RenderStage {
const framebuffer = view.window.framebuffer;
const renderPass = framebuffer.renderPass;
cmdBuff.begin();
cmdBuff.beginRenderPass(renderPass, framebuffer, this._renderArea!, [{ r: 0.0, g: 0.0, b: 0.0, a: 1.0 }], 1.0, 0);
const pso = PipelineStateManager.getOrCreatePipelineState(PipelineGlobal.device,
this._psoCreateInfo!, framebuffer.renderPass!, this._pipeline!.quadIA);
@@ -91,10 +84,6 @@ export class ToneMapStage extends RenderStage {
cmdBuff.bindInputAssembler(this._pipeline!.quadIA);
cmdBuff.draw(this._pipeline!.quadIA);
cmdBuff.endRenderPass();
cmdBuff.end();
bufs[0] = cmdBuff;
PipelineGlobal.device.queue.submit(bufs);
// this._pipeline.swapFBOs();
}
+8 -3
View File
@@ -11,6 +11,7 @@ import { RenderView } from './render-view';
import { legacyCC } from '../global-exports';
import { GFXClearFlag, GFXRenderPass, GFXColorAttachment, GFXDepthStencilAttachment, GFXLoadOp, GFXTextureLayout } from '../gfx';
import { PipelineGlobal } from './global';
import { SKYBOX_FLAG } from '../renderer';
/**
* @en Render flow information descriptor
@@ -97,7 +98,7 @@ export abstract class RenderFlow {
protected _priority: number = 0;
@property({
type: legacyCC.Material,
type: Material,
displayOrder: 2,
visible: true,
})
@@ -207,8 +208,12 @@ export abstract class RenderFlow {
depthStencilAttachment.format = device.depthStencilFormat;
if (!(clearFlags & GFXClearFlag.COLOR)) {
colorAttachment.loadOp = GFXLoadOp.LOAD;
colorAttachment.beginLayout = GFXTextureLayout.PRESENT_SRC;
if (clearFlags & SKYBOX_FLAG) {
colorAttachment.loadOp = GFXLoadOp.DISCARD;
} else {
colorAttachment.loadOp = GFXLoadOp.LOAD;
colorAttachment.beginLayout = GFXTextureLayout.PRESENT_SRC;
}
}
if ((clearFlags & GFXClearFlag.DEPTH_STENCIL) !== GFXClearFlag.DEPTH_STENCIL) {
+18 -1
View File
@@ -14,7 +14,8 @@ import {
GFXTextureLayout,
GFXTextureUsageBit,
GFXLoadOp,
GFXStoreOp} from '../gfx/define';
GFXStoreOp,
GFXCommandBufferType} from '../gfx/define';
import { GFXFeature } from '../gfx/device';
import { GFXFramebuffer } from '../gfx/framebuffer';
import { GFXInputAssembler, IGFXAttribute } from '../gfx/input-assembler';
@@ -33,6 +34,7 @@ import { RenderFlow } from './render-flow';
import { RenderView } from './render-view';
import { legacyCC } from '../global-exports';
import { PipelineGlobal } from './global';
import { GFXCommandBuffer } from '../gfx';
const v3_1 = new Vec3();
@@ -245,6 +247,15 @@ export abstract class RenderPipeline {
return this._prevIdx;
}
/**
* @en The primary command buffer this pipeline uses
* @zh 当前管线使用的一级命令缓冲
* @readonly
*/
get commandBuffers () {
return this._commandBuffers;
}
/**
* @en Whether use dynamic batching in this pipeline
* @zh 是否启用动态合批。
@@ -312,6 +323,7 @@ export abstract class RenderPipeline {
protected _fpScaleInv: number = 1024.0;
protected _macros: IDefineMap = {};
protected _useDynamicBatching = false;
protected _commandBuffers: GFXCommandBuffer[] = [];
@property({
type: [RenderTextureDesc],
@@ -831,6 +843,11 @@ export abstract class RenderPipeline {
});
this.addRenderPass(RenderPassStage.UI, uiPass);
this._commandBuffers[0] = PipelineGlobal.device.createCommandBuffer({
type: GFXCommandBufferType.PRIMARY,
queue: PipelineGlobal.device.queue,
});
// update global defines when all states initialized.
this._macros.CC_USE_HDR = (this._isHDR);
this._macros.CC_SUPPORT_FLOAT_TEXTURE =PipelineGlobal.device.hasFeature(GFXFeature.TEXTURE_FLOAT);
+2 -19
View File
@@ -148,12 +148,6 @@ export abstract class RenderStage {
protected _framebuffer: GFXFramebuffer | null = null;
/**
* @en The command buffer
* @zh 命令缓冲。
*/
protected _cmdBuff: GFXCommandBuffer | null = null;
/**
* @en The list of clear colors
* @zh 清空颜色数组。
@@ -363,7 +357,7 @@ export abstract class RenderStage {
public executeCommandBuffer (view: RenderView) {
const camera = view.camera;
const cmdBuff = this._cmdBuff!;
const cmdBuff = this._pipeline.commandBuffers[0];
const vp = camera.viewport;
this._renderArea!.x = vp.x * camera.width;
@@ -391,19 +385,8 @@ export abstract class RenderStage {
cmdBuff.endRenderPass();
cmdBuff.end();
bufs[0] = cmdBuff;
PipelineGlobal.device.queue.submit(bufs);
}
/**
* @en Create the main command buffer of this stage
* @zh 创建该阶段的主命令缓冲
*/
public createCmdBuffer () {
this._cmdBuff = PipelineGlobal.device.createCommandBuffer({
queue: PipelineGlobal.device.queue,
type: GFXCommandBufferType.PRIMARY,
});
PipelineGlobal.device.queue.submit(this._pipeline.commandBuffers);
}
/**
+2 -8
View File
@@ -31,14 +31,9 @@ export class UIStage extends RenderStage {
public activate (flow: RenderFlow) {
super.activate(flow);
this.createCmdBuffer();
}
public destroy () {
if (this._cmdBuff) {
this._cmdBuff.destroy();
this._cmdBuff = null;
}
}
public resize (width: number, height: number) {
@@ -69,7 +64,7 @@ export class UIStage extends RenderStage {
colors[0] = camera.clearColor;
const cmdBuff = this._cmdBuff!;
const cmdBuff = this._pipeline.commandBuffers[0];
const framebuffer = view.window.framebuffer;
const renderPass = framebuffer.colorTextures[0] ? framebuffer.renderPass : this._flow.getRenderPass(camera.clearFlag);
@@ -83,7 +78,6 @@ export class UIStage extends RenderStage {
cmdBuff.endRenderPass();
cmdBuff.end();
bufs[0] = cmdBuff;
PipelineGlobal.device.queue.submit(bufs);
PipelineGlobal.device.queue.submit(this._pipeline.commandBuffers);
}
}
+10 -8
View File
@@ -359,17 +359,19 @@ export class Root {
this._fpsTime = 0.0;
}
this._device.acquire();
if (this._pipeline) {
this._device.acquire();
const views = this._views;
for (let i = 0; i < views.length; i++) {
const view = views[i];
if (view.isEnable && view.window && this._pipeline) {
this._pipeline.render(view);
const views = this._views;
for (let i = 0; i < views.length; i++) {
const view = views[i];
if (view.isEnable && view.window) {
this._pipeline.render(view);
}
}
}
this._device.present();
this._device.present();
}
}
/**
+3 -3
View File
@@ -245,12 +245,12 @@ export class Profiler {
legacyCC.game.addPersistRootNode(this._rootNode);
const cameraNode = new Node('Profiler_Camera');
cameraNode.setPosition(0, 0, 1);
cameraNode.setPosition(0, 0, 1.5);
cameraNode.parent = this._rootNode;
const camera = cameraNode.addComponent('cc.CameraComponent') as CameraComponent;
camera.projection = CameraComponent.ProjectionType.ORTHO;
camera.near = 0;
camera.far = 0;
camera.near = 1;
camera.far = 2;
camera.orthoHeight = this._device!.height;
camera.visibility = Layers.BitMask.PROFILER;
camera.clearFlags = GFXClearFlag.NONE;