From a3982225e359a40f7ecb33592ac406031012fe18 Mon Sep 17 00:00:00 2001 From: Zhou Zhenglong Date: Thu, 21 Sep 2023 11:30:54 +0800 Subject: [PATCH] remove debug --- cocos/rendering/custom/archive.ts | 2 - cocos/rendering/custom/layout-graph.ts | 194 +++----------- cocos/rendering/custom/pipeline.ts | 19 -- cocos/rendering/custom/private.ts | 2 - cocos/rendering/custom/render-graph.ts | 347 ++++--------------------- cocos/rendering/custom/types.ts | 104 +------- cocos/rendering/custom/web-types.ts | 2 - 7 files changed, 93 insertions(+), 577 deletions(-) diff --git a/cocos/rendering/custom/archive.ts b/cocos/rendering/custom/archive.ts index 3d1ea4859c7..9b513ffc2bd 100644 --- a/cocos/rendering/custom/archive.ts +++ b/cocos/rendering/custom/archive.ts @@ -32,12 +32,10 @@ export interface OutputArchive { writeBool (value: boolean): void; writeNumber (value: number): void; writeString (value: string): void; - _pool?: boolean; } export interface InputArchive { readBool (): boolean; readNumber (): number; readString (): string; - _pool?: boolean; } diff --git a/cocos/rendering/custom/layout-graph.ts b/cocos/rendering/custom/layout-graph.ts index 9a4d2e3e587..4e8d25991dd 100644 --- a/cocos/rendering/custom/layout-graph.ts +++ b/cocos/rendering/custom/layout-graph.ts @@ -40,7 +40,6 @@ export class DescriptorDB { this.blocks.clear(); } readonly blocks: Map = new Map(); - _pool?: boolean; } export class RenderPhase { @@ -48,7 +47,6 @@ export class RenderPhase { this.shaders.clear(); } readonly shaders: Set = new Set(); - _pool?: boolean; } export enum RenderPassType { @@ -588,7 +586,6 @@ export class LayoutGraph implements BidirectionalGraph readonly _vertices: LayoutGraphVertex[] = []; readonly _names: string[] = []; readonly _descriptors: DescriptorDB[] = []; - _pool?: boolean; } export class UniformData { @@ -607,7 +604,6 @@ export class UniformData { uniformType: Type; offset: number; size = 0; - _pool?: boolean; } export class UniformBlockData { @@ -617,7 +613,6 @@ export class UniformBlockData { } bufferSize = 0; readonly uniforms: UniformData[] = []; - _pool?: boolean; } export class DescriptorData { @@ -634,7 +629,6 @@ export class DescriptorData { descriptorID: number; type: Type; count: number; - _pool?: boolean; } export class DescriptorBlockData { @@ -655,7 +649,6 @@ export class DescriptorBlockData { offset = 0; capacity: number; readonly descriptors: DescriptorData[] = []; - _pool?: boolean; } export class DescriptorSetLayoutData { @@ -691,7 +684,6 @@ export class DescriptorSetLayoutData { readonly descriptorBlocks: DescriptorBlockData[]; readonly uniformBlocks: Map; readonly bindingMap: Map; - _pool?: boolean; } export class DescriptorSetData { @@ -710,7 +702,6 @@ export class DescriptorSetData { readonly descriptorSetLayoutInfo: DescriptorSetLayoutInfo = new DescriptorSetLayoutInfo(); /*refcount*/ descriptorSetLayout: DescriptorSetLayout | null; /*refcount*/ descriptorSet: DescriptorSet | null; - _pool?: boolean; } export class PipelineLayoutData { @@ -718,7 +709,6 @@ export class PipelineLayoutData { this.descriptorSets.clear(); } readonly descriptorSets: Map = new Map(); - _pool?: boolean; } export class ShaderBindingData { @@ -726,7 +716,6 @@ export class ShaderBindingData { this.descriptorBindings.clear(); } readonly descriptorBindings: Map = new Map(); - _pool?: boolean; } export class ShaderLayoutData { @@ -736,7 +725,6 @@ export class ShaderLayoutData { } readonly layoutData: Map = new Map(); readonly bindingData: Map = new Map(); - _pool?: boolean; } export class TechniqueData { @@ -744,7 +732,6 @@ export class TechniqueData { this.passes.length = 0; } readonly passes: ShaderLayoutData[] = []; - _pool?: boolean; } export class EffectData { @@ -752,7 +739,6 @@ export class EffectData { this.techniques.clear(); } readonly techniques: Map = new Map(); - _pool?: boolean; } export class ShaderProgramData { @@ -762,7 +748,6 @@ export class ShaderProgramData { } readonly layout: PipelineLayoutData = new PipelineLayoutData(); /*refcount*/ pipelineLayout: PipelineLayout | null = null; - _pool?: boolean; } export class RenderStageData { @@ -770,7 +755,6 @@ export class RenderStageData { this.descriptorVisibility.clear(); } readonly descriptorVisibility: Map = new Map(); - _pool?: boolean; } export class RenderPhaseData { @@ -784,7 +768,6 @@ export class RenderPhaseData { readonly shaderPrograms: ShaderProgramData[] = []; readonly shaderIndex: Map = new Map(); /*refcount*/ pipelineLayout: PipelineLayout | null = null; - _pool?: boolean; } //================================================================= @@ -1351,7 +1334,6 @@ export class LayoutGraphData implements BidirectionalGraph readonly shaderLayoutIndex: Map = new Map(); readonly effects: Map = new Map(); constantMacros = ''; - _pool?: boolean; } export class LayoutGraphObjectPoolSettings { @@ -1437,36 +1419,18 @@ export class LayoutGraphObjectPool { this._renderPhaseData.reset(); this._layoutGraphData.reset(); } - createDescriptorDB (isDebug = true): DescriptorDB { - let v: DescriptorDB; - if (isDebug) { - v = new DescriptorDB(); - } else { - v = this._descriptorDB.add(); - v._pool = true; - } + createDescriptorDB (): DescriptorDB { + const v = this._descriptorDB.add(); v.reset(); return v; } - createRenderPhase (isDebug = true): RenderPhase { - let v: RenderPhase; - if (isDebug) { - v = new RenderPhase(); - } else { - v = this._renderPhase.add(); - v._pool = true; - } + createRenderPhase (): RenderPhase { + const v = this._renderPhase.add(); v.reset(); return v; } - createLayoutGraph (isDebug = true): LayoutGraph { - let v: LayoutGraph; - if (isDebug) { - v = new LayoutGraph(); - } else { - v = this._layoutGraph.add(); - v._pool = true; - } + createLayoutGraph (): LayoutGraph { + const v = this._layoutGraph.add(); v.clear(); return v; } @@ -1474,26 +1438,13 @@ export class LayoutGraphObjectPool { uniformID = 0xFFFFFFFF, uniformType: Type = Type.UNKNOWN, offset = 0, - isDebug = true, ): UniformData { - let v: UniformData; - if (isDebug) { - v = new UniformData(); - } else { - v = this._uniformData.add(); - v._pool = true; - } + const v = this._uniformData.add(); v.reset(uniformID, uniformType, offset); return v; } - createUniformBlockData (isDebug = true): UniformBlockData { - let v: UniformBlockData; - if (isDebug) { - v = new UniformBlockData(); - } else { - v = this._uniformBlockData.add(); - v._pool = true; - } + createUniformBlockData (): UniformBlockData { + const v = this._uniformBlockData.add(); v.reset(); return v; } @@ -1501,15 +1452,8 @@ export class LayoutGraphObjectPool { descriptorID = 0, type: Type = Type.UNKNOWN, count = 1, - isDebug = true, ): DescriptorData { - let v: DescriptorData; - if (isDebug) { - v = new DescriptorData(); - } else { - v = this._descriptorData.add(); - v._pool = true; - } + const v = this._descriptorData.add(); v.reset(descriptorID, type, count); return v; } @@ -1517,144 +1461,69 @@ export class LayoutGraphObjectPool { type: DescriptorTypeOrder = DescriptorTypeOrder.UNIFORM_BUFFER, visibility: ShaderStageFlagBit = ShaderStageFlagBit.NONE, capacity = 0, - isDebug = true, ): DescriptorBlockData { - let v: DescriptorBlockData; - if (isDebug) { - v = new DescriptorBlockData(); - } else { - v = this._descriptorBlockData.add(); - v._pool = true; - } + const v = this._descriptorBlockData.add(); v.reset(type, visibility, capacity); return v; } createDescriptorSetLayoutData ( slot = 0xFFFFFFFF, capacity = 0, - isDebug = true, ): DescriptorSetLayoutData { - let v: DescriptorSetLayoutData; - if (isDebug) { - v = new DescriptorSetLayoutData(); - } else { - v = this._descriptorSetLayoutData.add(); - v._pool = true; - } + const v = this._descriptorSetLayoutData.add(); v.reset(slot, capacity); return v; } createDescriptorSetData ( descriptorSetLayout: DescriptorSetLayout | null = null, descriptorSet: DescriptorSet | null = null, - isDebug = true, ): DescriptorSetData { - let v: DescriptorSetData; - if (isDebug) { - v = new DescriptorSetData(); - } else { - v = this._descriptorSetData.add(); - v._pool = true; - } + const v = this._descriptorSetData.add(); v.reset(descriptorSetLayout, descriptorSet); return v; } - createPipelineLayoutData (isDebug = true): PipelineLayoutData { - let v: PipelineLayoutData; - if (isDebug) { - v = new PipelineLayoutData(); - } else { - v = this._pipelineLayoutData.add(); - v._pool = true; - } + createPipelineLayoutData (): PipelineLayoutData { + const v = this._pipelineLayoutData.add(); v.reset(); return v; } - createShaderBindingData (isDebug = true): ShaderBindingData { - let v: ShaderBindingData; - if (isDebug) { - v = new ShaderBindingData(); - } else { - v = this._shaderBindingData.add(); - v._pool = true; - } + createShaderBindingData (): ShaderBindingData { + const v = this._shaderBindingData.add(); v.reset(); return v; } - createShaderLayoutData (isDebug = true): ShaderLayoutData { - let v: ShaderLayoutData; - if (isDebug) { - v = new ShaderLayoutData(); - } else { - v = this._shaderLayoutData.add(); - v._pool = true; - } + createShaderLayoutData (): ShaderLayoutData { + const v = this._shaderLayoutData.add(); v.reset(); return v; } - createTechniqueData (isDebug = true): TechniqueData { - let v: TechniqueData; - if (isDebug) { - v = new TechniqueData(); - } else { - v = this._techniqueData.add(); - v._pool = true; - } + createTechniqueData (): TechniqueData { + const v = this._techniqueData.add(); v.reset(); return v; } - createEffectData (isDebug = true): EffectData { - let v: EffectData; - if (isDebug) { - v = new EffectData(); - } else { - v = this._effectData.add(); - v._pool = true; - } + createEffectData (): EffectData { + const v = this._effectData.add(); v.reset(); return v; } - createShaderProgramData (isDebug = true): ShaderProgramData { - let v: ShaderProgramData; - if (isDebug) { - v = new ShaderProgramData(); - } else { - v = this._shaderProgramData.add(); - v._pool = true; - } + createShaderProgramData (): ShaderProgramData { + const v = this._shaderProgramData.add(); v.reset(); return v; } - createRenderStageData (isDebug = true): RenderStageData { - let v: RenderStageData; - if (isDebug) { - v = new RenderStageData(); - } else { - v = this._renderStageData.add(); - v._pool = true; - } + createRenderStageData (): RenderStageData { + const v = this._renderStageData.add(); v.reset(); return v; } - createRenderPhaseData (isDebug = true): RenderPhaseData { - let v: RenderPhaseData; - if (isDebug) { - v = new RenderPhaseData(); - } else { - v = this._renderPhaseData.add(); - v._pool = true; - } + createRenderPhaseData (): RenderPhaseData { + const v = this._renderPhaseData.add(); v.reset(); return v; } - createLayoutGraphData (isDebug = true): LayoutGraphData { - let v: LayoutGraphData; - if (isDebug) { - v = new LayoutGraphData(); - } else { - v = this._layoutGraphData.add(); - v._pool = true; - } + createLayoutGraphData (): LayoutGraphData { + const v = this._layoutGraphData.add(); v.clear(); return v; } @@ -1677,7 +1546,6 @@ export class LayoutGraphObjectPool { private readonly _renderStageData: RecyclePool; private readonly _renderPhaseData: RecyclePool; private readonly _layoutGraphData: RecyclePool; - public debug = false; } export function saveDescriptorDB (ar: OutputArchive, v: DescriptorDB): void { diff --git a/cocos/rendering/custom/pipeline.ts b/cocos/rendering/custom/pipeline.ts index 0dcb547d86a..e97d787ff1f 100644 --- a/cocos/rendering/custom/pipeline.ts +++ b/cocos/rendering/custom/pipeline.ts @@ -179,7 +179,6 @@ export interface PipelineRuntime { * @zh 触发管线状态更新事件 */ onGlobalPipelineStateChanged (): void; - _pool?: boolean; } /** @@ -269,7 +268,6 @@ export enum SubpassCapabilities { */ export class PipelineCapabilities { subpass: SubpassCapabilities = SubpassCapabilities.NONE; - _pool?: boolean; } /** @@ -288,7 +286,6 @@ export interface RenderNode { * @experimental */ setCustomBehavior (name: string): void; - _pool?: boolean; } /** @@ -393,7 +390,6 @@ export interface Setter extends RenderNode { light: DirectionalLight, csmLevel?: number): void; setBuiltinSpotLightFrustumConstants (light: SpotLight): void; - _pool?: boolean; } export interface SceneBuilder extends Setter { @@ -401,7 +397,6 @@ export interface SceneBuilder extends Setter { light: Light, csmLevel?: number, optCamera?: Camera): void; - _pool?: boolean; } /** @@ -470,7 +465,6 @@ export interface RenderQueueBuilder extends Setter { * @experimental */ addCustomCommand (customBehavior: string): void; - _pool?: boolean; } /** @@ -565,7 +559,6 @@ export interface BasicRenderPassBuilder extends Setter { * @zh 在屏幕上渲染统计数据 */ showStatistics: boolean; - _pool?: boolean; } export interface BasicMultisampleRenderPassBuilder extends BasicRenderPassBuilder { @@ -575,7 +568,6 @@ export interface BasicMultisampleRenderPassBuilder extends BasicRenderPassBuilde target: string, depthMode?: ResolveMode, stencilMode?: ResolveMode): void; - _pool?: boolean; } /** @@ -824,7 +816,6 @@ export interface BasicPipeline extends PipelineRuntime { * @engineInternal */ getDescriptorSetLayout (shaderName: string, freq: UpdateFrequency): DescriptorSetLayout | undefined; - _pool?: boolean; } /** @@ -954,7 +945,6 @@ export interface RenderSubpassBuilder extends Setter { * @experimental */ setCustomShaderStages (name: string, stageFlags: ShaderStageFlagBit): void; - _pool?: boolean; } /** @@ -983,7 +973,6 @@ export interface MultisampleRenderSubpassBuilder extends RenderSubpassBuilder { target: string, depthMode?: ResolveMode, stencilMode?: ResolveMode): void; - _pool?: boolean; } /** @@ -1006,7 +995,6 @@ export interface ComputeQueueBuilder extends Setter { threadGroupCountZ: number, material?: Material, passID?: number): void; - _pool?: boolean; } /** @@ -1090,7 +1078,6 @@ export interface ComputeSubpassBuilder extends Setter { * @experimental */ setCustomShaderStages (name: string, stageFlags: ShaderStageFlagBit): void; - _pool?: boolean; } /** @@ -1161,7 +1148,6 @@ export interface RenderPassBuilder extends BasicRenderPassBuilder { * @experimental */ setCustomShaderStages (name: string, stageFlags: ShaderStageFlagBit): void; - _pool?: boolean; } export interface MultisampleRenderPassBuilder extends BasicMultisampleRenderPassBuilder { @@ -1173,7 +1159,6 @@ export interface MultisampleRenderPassBuilder extends BasicMultisampleRenderPass name: string, accessType: AccessType, slotName: string): void; - _pool?: boolean; } /** @@ -1253,7 +1238,6 @@ export interface ComputePassBuilder extends Setter { * @experimental */ setCustomShaderStages (name: string, stageFlags: ShaderStageFlagBit): void; - _pool?: boolean; } /** @@ -1424,7 +1408,6 @@ export interface Pipeline extends BasicPipeline { name: string, info: TextureInfo, type: string): number; - _pool?: boolean; } /** @@ -1444,7 +1427,6 @@ export interface PipelineBuilder { */ setup (cameras: Camera[], pipeline: BasicPipeline): void; onGlobalPipelineStateChanged? (): void; - _pool?: boolean; } /** @@ -1454,5 +1436,4 @@ export interface RenderingModule { getPassID (name: string): number; getSubpassID (passID: number, name: string): number; getPhaseID (subpassOrPassID: number, name: string): number; - _pool?: boolean; } diff --git a/cocos/rendering/custom/private.ts b/cocos/rendering/custom/private.ts index 13566b9c74b..b4cae1f5d17 100644 --- a/cocos/rendering/custom/private.ts +++ b/cocos/rendering/custom/private.ts @@ -36,7 +36,6 @@ import { IProgramInfo } from '../../render-scene/core/program-lib'; export interface ProgramProxy { readonly name: string; readonly shader: Shader; - _pool?: boolean; } export interface ProgramLibrary { @@ -71,5 +70,4 @@ export interface ProgramLibrary { getProgramID (phaseID: number, programName: string): number; getDescriptorNameID (name: string): number; getDescriptorName (nameID: number): string; - _pool?: boolean; } diff --git a/cocos/rendering/custom/render-graph.ts b/cocos/rendering/custom/render-graph.ts index 05b4e000448..135d22cd640 100644 --- a/cocos/rendering/custom/render-graph.ts +++ b/cocos/rendering/custom/render-graph.ts @@ -55,7 +55,6 @@ export class ClearValue { y: number; z: number; w: number; - _pool?: boolean; } export class RasterView { @@ -108,7 +107,6 @@ export class RasterView { readonly clearColor: Color; slotID = 0; shaderStageFlags: ShaderStageFlagBit; - _pool?: boolean; } export class ComputeView { @@ -149,7 +147,6 @@ export class ComputeView { clearValueType: ClearValueType; readonly clearValue: ClearValue; shaderStageFlags: ShaderStageFlagBit; - _pool?: boolean; } export class ResourceDesc { @@ -177,7 +174,6 @@ export class ResourceDesc { textureFlags: TextureFlagBit = TextureFlagBit.NONE; flags: ResourceFlags = ResourceFlags.NONE; viewType: TextureType = TextureType.TEX2D; - _pool?: boolean; } export class ResourceTraits { @@ -188,7 +184,6 @@ export class ResourceTraits { this.residency = residency; } residency: ResourceResidency; - _pool?: boolean; } export class RenderSwapchain { @@ -207,7 +202,6 @@ export class RenderSwapchain { currentID = 0; numBackBuffers = 0; generation = 0xFFFFFFFF; - _pool?: boolean; } export class ResourceStates { @@ -215,7 +209,6 @@ export class ResourceStates { this.states = AccessFlagBit.NONE; } states: AccessFlagBit = AccessFlagBit.NONE; - _pool?: boolean; } export class ManagedBuffer { @@ -228,7 +221,6 @@ export class ManagedBuffer { } /*refcount*/ buffer: Buffer | null; fenceValue = 0; - _pool?: boolean; } export class PersistentBuffer { @@ -241,7 +233,6 @@ export class PersistentBuffer { } /*refcount*/ buffer: Buffer | null; fenceValue = 0; - _pool?: boolean; } export class ManagedTexture { @@ -254,7 +245,6 @@ export class ManagedTexture { } /*refcount*/ texture: Texture | null; fenceValue = 0; - _pool?: boolean; } export class PersistentTexture { @@ -267,7 +257,6 @@ export class PersistentTexture { } /*refcount*/ texture: Texture | null; fenceValue = 0; - _pool?: boolean; } export class ManagedResource { @@ -275,7 +264,6 @@ export class ManagedResource { this.unused = 0; } unused = 0; - _pool?: boolean; } export class Subpass { @@ -287,7 +275,6 @@ export class Subpass { readonly rasterViews: Map = new Map(); readonly computeViews: Map = new Map(); readonly resolvePairs: ResolvePair[] = []; - _pool?: boolean; } //================================================================= @@ -589,7 +576,6 @@ export class SubpassGraph implements BidirectionalGraph readonly _vertices: SubpassGraphVertex[] = []; readonly _names: string[] = []; readonly _subpasses: Subpass[] = []; - _pool?: boolean; } export class RasterSubpass { @@ -616,7 +602,6 @@ export class RasterSubpass { count: number; quality: number; showStatistics = false; - _pool?: boolean; } export class ComputeSubpass { @@ -631,7 +616,6 @@ export class ComputeSubpass { readonly rasterViews: Map = new Map(); readonly computeViews: Map = new Map(); subpassID: number; - _pool?: boolean; } export class RasterPass { @@ -665,7 +649,6 @@ export class RasterPass { version = 0; hashValue = 0; showStatistics = false; - _pool?: boolean; } export class PersistentRenderPassAndFramebuffer { @@ -685,7 +668,6 @@ export class PersistentRenderPassAndFramebuffer { readonly clearColors: Color[] = []; clearDepth = 0; clearStencil = 0; - _pool?: boolean; } export class FormatView { @@ -693,7 +675,6 @@ export class FormatView { this.format = Format.UNKNOWN; } format: Format = Format.UNKNOWN; - _pool?: boolean; } export class SubresourceView { @@ -715,7 +696,6 @@ export class SubresourceView { numArraySlices = 0; firstPlane = 0; numPlanes = 0; - _pool?: boolean; } //================================================================= @@ -1467,7 +1447,6 @@ export class ResourceGraph implements BidirectionalGraph readonly renderPasses: Map = new Map(); nextFenceValue = 0; version = 0; - _pool?: boolean; } export class ComputePass { @@ -1477,7 +1456,6 @@ export class ComputePass { } readonly computeViews: Map = new Map(); readonly textures: Map = new Map(); - _pool?: boolean; } export class ResolvePass { @@ -1485,7 +1463,6 @@ export class ResolvePass { this.resolvePairs.length = 0; } readonly resolvePairs: ResolvePair[] = []; - _pool?: boolean; } export class CopyPass { @@ -1495,7 +1472,6 @@ export class CopyPass { } readonly copyPairs: CopyPair[] = []; readonly uploadPairs: UploadPair[] = []; - _pool?: boolean; } export class MovePass { @@ -1503,7 +1479,6 @@ export class MovePass { this.movePairs.length = 0; } readonly movePairs: MovePair[] = []; - _pool?: boolean; } export class RaytracePass { @@ -1511,7 +1486,6 @@ export class RaytracePass { this.computeViews.clear(); } readonly computeViews: Map = new Map(); - _pool?: boolean; } export class ClearView { @@ -1528,7 +1502,6 @@ export class ClearView { slotName: string; clearFlags: ClearFlagBit; readonly clearColor: Color; - _pool?: boolean; } export class RenderQueue { @@ -1544,7 +1517,6 @@ export class RenderQueue { hint: QueueHint; phaseID: number; viewport: Viewport | null = null; - _pool?: boolean; } export enum CullingFlags { @@ -1590,7 +1562,6 @@ export class SceneData { flags: SceneFlags; cullingFlags: CullingFlags; /*refcount*/ shadingLight: Light | null; - _pool?: boolean; } export class Dispatch { @@ -1625,7 +1596,6 @@ export class Dispatch { threadGroupCountX: number; threadGroupCountY: number; threadGroupCountZ: number; - _pool?: boolean; } export class Blit { @@ -1645,7 +1615,6 @@ export class Blit { passID: number; sceneFlags: SceneFlags; /*pointer*/ camera: Camera | null; - _pool?: boolean; } export class RenderData { @@ -1661,7 +1630,6 @@ export class RenderData { readonly textures: Map = new Map(); readonly samplers: Map = new Map(); custom = ''; - _pool?: boolean; } //================================================================= @@ -2546,7 +2514,6 @@ export class RenderGraph implements BidirectionalGraph readonly _valid: boolean[] = []; readonly index: Map = new Map(); readonly sortedVertices: number[] = []; - _pool?: boolean; } export class RenderGraphObjectPoolSettings { @@ -2697,15 +2664,8 @@ export class RenderGraphObjectPool { y = 0, z = 0, w = 0, - isDebug = true, ): ClearValue { - let v: ClearValue; - if (isDebug) { - v = new ClearValue(); - } else { - v = this._clearValue.add(); - v._pool = true; - } + const v = this._clearValue.add(); v.reset(x, y, z, w); return v; } @@ -2717,15 +2677,8 @@ export class RenderGraphObjectPool { storeOp: StoreOp = StoreOp.STORE, clearFlags: ClearFlagBit = ClearFlagBit.ALL, shaderStageFlags: ShaderStageFlagBit = ShaderStageFlagBit.NONE, - isDebug = true, ): RasterView { - let v: RasterView; - if (isDebug) { - v = new RasterView(); - } else { - v = this._rasterView.add(); - v._pool = true; - } + const v = this._rasterView.add(); v.reset(slotName, accessType, attachmentType, loadOp, storeOp, clearFlags, shaderStageFlags); return v; } @@ -2735,154 +2688,75 @@ export class RenderGraphObjectPool { clearFlags: ClearFlagBit = ClearFlagBit.NONE, clearValueType: ClearValueType = ClearValueType.NONE, shaderStageFlags: ShaderStageFlagBit = ShaderStageFlagBit.NONE, - isDebug = true, ): ComputeView { - let v: ComputeView; - if (isDebug) { - v = new ComputeView(); - } else { - v = this._computeView.add(); - v._pool = true; - } + const v = this._computeView.add(); v.reset(name, accessType, clearFlags, clearValueType, shaderStageFlags); return v; } - createResourceDesc (isDebug = true): ResourceDesc { - let v: ResourceDesc; - if (isDebug) { - v = new ResourceDesc(); - } else { - v = this._resourceDesc.add(); - v._pool = true; - } + createResourceDesc (): ResourceDesc { + const v = this._resourceDesc.add(); v.reset(); return v; } createResourceTraits ( residency: ResourceResidency = ResourceResidency.MANAGED, - isDebug = true, ): ResourceTraits { - let v: ResourceTraits; - if (isDebug) { - v = new ResourceTraits(); - } else { - v = this._resourceTraits.add(); - v._pool = true; - } + const v = this._resourceTraits.add(); v.reset(residency); return v; } createRenderSwapchain ( swapchain: Swapchain | null = null, - isDebug = true, ): RenderSwapchain { - let v: RenderSwapchain; - if (isDebug) { - v = new RenderSwapchain(); - } else { - v = this._renderSwapchain.add(); - v._pool = true; - } + const v = this._renderSwapchain.add(); v.reset(swapchain); return v; } - createResourceStates (isDebug = true): ResourceStates { - let v: ResourceStates; - if (isDebug) { - v = new ResourceStates(); - } else { - v = this._resourceStates.add(); - v._pool = true; - } + createResourceStates (): ResourceStates { + const v = this._resourceStates.add(); v.reset(); return v; } createManagedBuffer ( buffer: Buffer | null = null, - isDebug = true, ): ManagedBuffer { - let v: ManagedBuffer; - if (isDebug) { - v = new ManagedBuffer(); - } else { - v = this._managedBuffer.add(); - v._pool = true; - } + const v = this._managedBuffer.add(); v.reset(buffer); return v; } createPersistentBuffer ( buffer: Buffer | null = null, - isDebug = true, ): PersistentBuffer { - let v: PersistentBuffer; - if (isDebug) { - v = new PersistentBuffer(); - } else { - v = this._persistentBuffer.add(); - v._pool = true; - } + const v = this._persistentBuffer.add(); v.reset(buffer); return v; } createManagedTexture ( texture: Texture | null = null, - isDebug = true, ): ManagedTexture { - let v: ManagedTexture; - if (isDebug) { - v = new ManagedTexture(); - } else { - v = this._managedTexture.add(); - v._pool = true; - } + const v = this._managedTexture.add(); v.reset(texture); return v; } createPersistentTexture ( texture: Texture | null = null, - isDebug = true, ): PersistentTexture { - let v: PersistentTexture; - if (isDebug) { - v = new PersistentTexture(); - } else { - v = this._persistentTexture.add(); - v._pool = true; - } + const v = this._persistentTexture.add(); v.reset(texture); return v; } - createManagedResource (isDebug = true): ManagedResource { - let v: ManagedResource; - if (isDebug) { - v = new ManagedResource(); - } else { - v = this._managedResource.add(); - v._pool = true; - } + createManagedResource (): ManagedResource { + const v = this._managedResource.add(); v.reset(); return v; } - createSubpass (isDebug = true): Subpass { - let v: Subpass; - if (isDebug) { - v = new Subpass(); - } else { - v = this._subpass.add(); - v._pool = true; - } + createSubpass (): Subpass { + const v = this._subpass.add(); v.reset(); return v; } - createSubpassGraph (isDebug = true): SubpassGraph { - let v: SubpassGraph; - if (isDebug) { - v = new SubpassGraph(); - } else { - v = this._subpassGraph.add(); - v._pool = true; - } + createSubpassGraph (): SubpassGraph { + const v = this._subpassGraph.add(); v.clear(); return v; } @@ -2890,173 +2764,84 @@ export class RenderGraphObjectPool { subpassID = 0xFFFFFFFF, count = 1, quality = 0, - isDebug = true, ): RasterSubpass { - let v: RasterSubpass; - if (isDebug) { - v = new RasterSubpass(); - } else { - v = this._rasterSubpass.add(); - v._pool = true; - } + const v = this._rasterSubpass.add(); v.reset(subpassID, count, quality); return v; } createComputeSubpass ( subpassID = 0xFFFFFFFF, - isDebug = true, ): ComputeSubpass { - let v: ComputeSubpass; - if (isDebug) { - v = new ComputeSubpass(); - } else { - v = this._computeSubpass.add(); - v._pool = true; - } + const v = this._computeSubpass.add(); v.reset(subpassID); return v; } - createRasterPass (isDebug = true): RasterPass { - let v: RasterPass; - if (isDebug) { - v = new RasterPass(); - } else { - v = this._rasterPass.add(); - v._pool = true; - } + createRasterPass (): RasterPass { + const v = this._rasterPass.add(); v.reset(); return v; } createPersistentRenderPassAndFramebuffer ( renderPass: RenderPass | null = null, framebuffer: Framebuffer | null = null, - isDebug = true, ): PersistentRenderPassAndFramebuffer { - let v: PersistentRenderPassAndFramebuffer; - if (isDebug) { - v = new PersistentRenderPassAndFramebuffer(); - } else { - v = this._persistentRenderPassAndFramebuffer.add(); - v._pool = true; - } + const v = this._persistentRenderPassAndFramebuffer.add(); v.reset(renderPass, framebuffer); return v; } - createFormatView (isDebug = true): FormatView { - let v: FormatView; - if (isDebug) { - v = new FormatView(); - } else { - v = this._formatView.add(); - v._pool = true; - } + createFormatView (): FormatView { + const v = this._formatView.add(); v.reset(); return v; } - createSubresourceView (isDebug = true): SubresourceView { - let v: SubresourceView; - if (isDebug) { - v = new SubresourceView(); - } else { - v = this._subresourceView.add(); - v._pool = true; - } + createSubresourceView (): SubresourceView { + const v = this._subresourceView.add(); v.reset(); return v; } - createResourceGraph (isDebug = true): ResourceGraph { - let v: ResourceGraph; - if (isDebug) { - v = new ResourceGraph(); - } else { - v = this._resourceGraph.add(); - v._pool = true; - } + createResourceGraph (): ResourceGraph { + const v = this._resourceGraph.add(); v.clear(); return v; } - createComputePass (isDebug = true): ComputePass { - let v: ComputePass; - if (isDebug) { - v = new ComputePass(); - } else { - v = this._computePass.add(); - v._pool = true; - } + createComputePass (): ComputePass { + const v = this._computePass.add(); v.reset(); return v; } - createResolvePass (isDebug = true): ResolvePass { - let v: ResolvePass; - if (isDebug) { - v = new ResolvePass(); - } else { - v = this._resolvePass.add(); - v._pool = true; - } + createResolvePass (): ResolvePass { + const v = this._resolvePass.add(); v.reset(); return v; } - createCopyPass (isDebug = true): CopyPass { - let v: CopyPass; - if (isDebug) { - v = new CopyPass(); - } else { - v = this._copyPass.add(); - v._pool = true; - } + createCopyPass (): CopyPass { + const v = this._copyPass.add(); v.reset(); return v; } - createMovePass (isDebug = true): MovePass { - let v: MovePass; - if (isDebug) { - v = new MovePass(); - } else { - v = this._movePass.add(); - v._pool = true; - } + createMovePass (): MovePass { + const v = this._movePass.add(); v.reset(); return v; } - createRaytracePass (isDebug = true): RaytracePass { - let v: RaytracePass; - if (isDebug) { - v = new RaytracePass(); - } else { - v = this._raytracePass.add(); - v._pool = true; - } + createRaytracePass (): RaytracePass { + const v = this._raytracePass.add(); v.reset(); return v; } createClearView ( slotName = '', clearFlags: ClearFlagBit = ClearFlagBit.ALL, - isDebug = true, ): ClearView { - let v: ClearView; - if (isDebug) { - v = new ClearView(); - } else { - v = this._clearView.add(); - v._pool = true; - } + const v = this._clearView.add(); v.reset(slotName, clearFlags); return v; } createRenderQueue ( hint: QueueHint = QueueHint.RENDER_OPAQUE, phaseID = 0xFFFFFFFF, - isDebug = true, ): RenderQueue { - let v: RenderQueue; - if (isDebug) { - v = new RenderQueue(); - } else { - v = this._renderQueue.add(); - v._pool = true; - } + const v = this._renderQueue.add(); v.reset(hint, phaseID); return v; } @@ -3066,15 +2851,8 @@ export class RenderGraphObjectPool { flags: SceneFlags = SceneFlags.NONE, cullingFlags: CullingFlags = CullingFlags.CAMERA_FRUSTUM, shadingLight: Light | null = null, - isDebug = true, ): SceneData { - let v: SceneData; - if (isDebug) { - v = new SceneData(); - } else { - v = this._sceneData.add(); - v._pool = true; - } + const v = this._sceneData.add(); v.reset(scene, camera, flags, cullingFlags, shadingLight); return v; } @@ -3084,15 +2862,8 @@ export class RenderGraphObjectPool { threadGroupCountX = 0, threadGroupCountY = 0, threadGroupCountZ = 0, - isDebug = true, ): Dispatch { - let v: Dispatch; - if (isDebug) { - v = new Dispatch(); - } else { - v = this._dispatch.add(); - v._pool = true; - } + const v = this._dispatch.add(); v.reset(material, passID, threadGroupCountX, threadGroupCountY, threadGroupCountZ); return v; } @@ -3101,37 +2872,18 @@ export class RenderGraphObjectPool { passID = 0, sceneFlags: SceneFlags = SceneFlags.NONE, camera: Camera | null = null, - isDebug = true, ): Blit { - let v: Blit; - if (isDebug) { - v = new Blit(); - } else { - v = this._blit.add(); - v._pool = true; - } + const v = this._blit.add(); v.reset(material, passID, sceneFlags, camera); return v; } - createRenderData (isDebug = true): RenderData { - let v: RenderData; - if (isDebug) { - v = new RenderData(); - } else { - v = this._renderData.add(); - v._pool = true; - } + createRenderData (): RenderData { + const v = this._renderData.add(); v.reset(); return v; } - createRenderGraph (isDebug = true): RenderGraph { - let v: RenderGraph; - if (isDebug) { - v = new RenderGraph(); - } else { - v = this._renderGraph.add(); - v._pool = true; - } + createRenderGraph (): RenderGraph { + const v = this._renderGraph.add(); v.clear(); return v; } @@ -3169,5 +2921,4 @@ export class RenderGraphObjectPool { private readonly _blit: RecyclePool; private readonly _renderData: RecyclePool; private readonly _renderGraph: RecyclePool; - public debug = false; } diff --git a/cocos/rendering/custom/types.ts b/cocos/rendering/custom/types.ts index 21ac51db9ba..577955e8017 100644 --- a/cocos/rendering/custom/types.ts +++ b/cocos/rendering/custom/types.ts @@ -307,7 +307,6 @@ export class LightInfo { /*pointer*/ probe: ReflectionProbe | null; level: number; culledByLight: boolean; - _pool?: boolean; } export enum DescriptorTypeOrder { @@ -357,7 +356,6 @@ export class Descriptor { } type: Type; count = 1; - _pool?: boolean; } export class DescriptorBlock { @@ -371,7 +369,6 @@ export class DescriptorBlock { readonly uniformBlocks: Map = new Map(); capacity = 0; count = 0; - _pool?: boolean; } export class DescriptorBlockFlattened { @@ -389,7 +386,6 @@ export class DescriptorBlockFlattened { readonly uniformBlocks: UniformBlock[] = []; capacity = 0; count = 0; - _pool?: boolean; } export class DescriptorBlockIndex { @@ -403,7 +399,6 @@ export class DescriptorBlockIndex { parameterType: ParameterType; descriptorType: DescriptorTypeOrder; visibility: ShaderStageFlagBit; - _pool?: boolean; } export enum ResolveFlags { @@ -445,7 +440,6 @@ export class ResolvePair { resolveFlags: ResolveFlags; mode: ResolveMode; mode1: ResolveMode; - _pool?: boolean; } export class CopyPair { @@ -505,7 +499,6 @@ export class CopyPair { targetMostDetailedMip: number; targetFirstSlice: number; targetPlaneSlice: number; - _pool?: boolean; } export class UploadPair { @@ -549,7 +542,6 @@ export class UploadPair { targetMostDetailedMip: number; targetFirstSlice: number; targetPlaneSlice: number; - _pool?: boolean; } export class MovePair { @@ -594,7 +586,6 @@ export class MovePair { targetMostDetailedMip: number; targetFirstSlice: number; targetPlaneSlice: number; - _pool?: boolean; } export class PipelineStatistics { @@ -622,7 +613,6 @@ export class PipelineStatistics { numFreeDescriptorSets = 0; numInstancingBuffers = 0; numInstancingUniformBlocks = 0; - _pool?: boolean; } export class RenderCommonObjectPoolSettings { @@ -680,51 +670,25 @@ export class RenderCommonObjectPool { level = 0, culledByLight = false, probe: ReflectionProbe | null = null, - isDebug = true, ): LightInfo { - let v: LightInfo; - if (isDebug) { - v = new LightInfo(); - } else { - v = this._lightInfo.add(); - v._pool = true; - } + const v = this._lightInfo.add(); v.reset(light, level, culledByLight, probe); return v; } createDescriptor ( type: Type = Type.UNKNOWN, - isDebug = true, ): Descriptor { - let v: Descriptor; - if (isDebug) { - v = new Descriptor(); - } else { - v = this._descriptor.add(); - v._pool = true; - } + const v = this._descriptor.add(); v.reset(type); return v; } - createDescriptorBlock (isDebug = true): DescriptorBlock { - let v: DescriptorBlock; - if (isDebug) { - v = new DescriptorBlock(); - } else { - v = this._descriptorBlock.add(); - v._pool = true; - } + createDescriptorBlock (): DescriptorBlock { + const v = this._descriptorBlock.add(); v.reset(); return v; } - createDescriptorBlockFlattened (isDebug = true): DescriptorBlockFlattened { - let v: DescriptorBlockFlattened; - if (isDebug) { - v = new DescriptorBlockFlattened(); - } else { - v = this._descriptorBlockFlattened.add(); - v._pool = true; - } + createDescriptorBlockFlattened (): DescriptorBlockFlattened { + const v = this._descriptorBlockFlattened.add(); v.reset(); return v; } @@ -733,15 +697,8 @@ export class RenderCommonObjectPool { parameterType: ParameterType = ParameterType.CONSTANTS, descriptorType: DescriptorTypeOrder = DescriptorTypeOrder.UNIFORM_BUFFER, visibility: ShaderStageFlagBit = ShaderStageFlagBit.NONE, - isDebug = true, ): DescriptorBlockIndex { - let v: DescriptorBlockIndex; - if (isDebug) { - v = new DescriptorBlockIndex(); - } else { - v = this._descriptorBlockIndex.add(); - v._pool = true; - } + const v = this._descriptorBlockIndex.add(); v.updateFrequency = updateFrequency; v.parameterType = parameterType; v.descriptorType = descriptorType; @@ -754,15 +711,8 @@ export class RenderCommonObjectPool { resolveFlags: ResolveFlags = ResolveFlags.NONE, mode: ResolveMode = ResolveMode.SAMPLE_ZERO, mode1: ResolveMode = ResolveMode.SAMPLE_ZERO, - isDebug = true, ): ResolvePair { - let v: ResolvePair; - if (isDebug) { - v = new ResolvePair(); - } else { - v = this._resolvePair.add(); - v._pool = true; - } + const v = this._resolvePair.add(); v.reset(source, target, resolveFlags, mode, mode1); return v; } @@ -777,15 +727,8 @@ export class RenderCommonObjectPool { targetMostDetailedMip = 0, targetFirstSlice = 0, targetPlaneSlice = 0, - isDebug = true, ): CopyPair { - let v: CopyPair; - if (isDebug) { - v = new CopyPair(); - } else { - v = this._copyPair.add(); - v._pool = true; - } + const v = this._copyPair.add(); v.reset(source, target, mipLevels, numSlices, sourceMostDetailedMip, sourceFirstSlice, sourcePlaneSlice, targetMostDetailedMip, targetFirstSlice, targetPlaneSlice); return v; } @@ -796,15 +739,8 @@ export class RenderCommonObjectPool { targetMostDetailedMip = 0, targetFirstSlice = 0, targetPlaneSlice = 0, - isDebug = true, ): UploadPair { - let v: UploadPair; - if (isDebug) { - v = new UploadPair(); - } else { - v = this._uploadPair.add(); - v._pool = true; - } + const v = this._uploadPair.add(); v.reset(target, mipLevels, numSlices, targetMostDetailedMip, targetFirstSlice, targetPlaneSlice); return v; } @@ -816,26 +752,13 @@ export class RenderCommonObjectPool { targetMostDetailedMip = 0, targetFirstSlice = 0, targetPlaneSlice = 0, - isDebug = true, ): MovePair { - let v: MovePair; - if (isDebug) { - v = new MovePair(); - } else { - v = this._movePair.add(); - v._pool = true; - } + const v = this._movePair.add(); v.reset(source, target, mipLevels, numSlices, targetMostDetailedMip, targetFirstSlice, targetPlaneSlice); return v; } - createPipelineStatistics (isDebug = true): PipelineStatistics { - let v: PipelineStatistics; - if (isDebug) { - v = new PipelineStatistics(); - } else { - v = this._pipelineStatistics.add(); - v._pool = true; - } + createPipelineStatistics (): PipelineStatistics { + const v = this._pipelineStatistics.add(); v.reset(); return v; } @@ -849,7 +772,6 @@ export class RenderCommonObjectPool { private readonly _uploadPair: RecyclePool; private readonly _movePair: RecyclePool; private readonly _pipelineStatistics: RecyclePool; - public debug = false; } export function saveLightInfo (ar: OutputArchive, v: LightInfo): void { diff --git a/cocos/rendering/custom/web-types.ts b/cocos/rendering/custom/web-types.ts index 1760987eb42..b275b9abde9 100644 --- a/cocos/rendering/custom/web-types.ts +++ b/cocos/rendering/custom/web-types.ts @@ -51,11 +51,9 @@ export class ProgramInfo { readonly attributes: Attribute[]; readonly blockSizes: number[]; readonly handleMap: Record; - _pool?: boolean; } export class ProgramGroup { readonly programInfos: Map = new Map(); readonly programProxies: Map = new Map(); - _pool?: boolean; }