diff --git a/cc.config.json b/cc.config.json index 32a7b1d7a7..5cd592db5f 100644 --- a/cc.config.json +++ b/cc.config.json @@ -37,7 +37,8 @@ "intrinsicFlags": { "MARIONETTE": true } - } + }, + "custom-pipeline": { "modules": ["custom-pipeline"] } }, "moduleOverrides": [ { diff --git a/cocos/core/pipeline/custom/index.ts b/cocos/core/pipeline/custom/index.ts index 9a11f74bac..26d09084e4 100644 --- a/cocos/core/pipeline/custom/index.ts +++ b/cocos/core/pipeline/custom/index.ts @@ -25,14 +25,7 @@ import { Pipeline } from './pipeline'; import { WebPipeline } from './web-pipeline'; -import { rebuildLayoutGraph } from './effect'; -import { legacyCC } from '../../global-exports'; export function createCustomPipeline (): Pipeline { - const ppl = new WebPipeline(); - const director = legacyCC.director; - if (director.root.usesCustomPipeline) { - director.on(legacyCC.Director.EVENT_BEFORE_DRAW, rebuildLayoutGraph); - } - return ppl; + return new WebPipeline(); } diff --git a/cocos/core/pipeline/custom/web-pipeline-impl.ts b/cocos/core/pipeline/custom/web-pipeline-impl.ts deleted file mode 100644 index 77202b1316..0000000000 --- a/cocos/core/pipeline/custom/web-pipeline-impl.ts +++ /dev/null @@ -1,34 +0,0 @@ -/**************************************************************************** - Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd. - - http://www.cocos.com - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license - to use Cocos Creator solely to develop games on your target platforms. You shall - not use Cocos Creator software for developing other software or tools that's - used for developing games. You are not granted to publish, distribute, - sublicense, and/or sell copies of Cocos Creator. - - The software or tools in this License Agreement are licensed, not sold. - Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -****************************************************************************/ - -/** - * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= - * The following section is auto-generated. - * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= - */ -/* eslint-disable max-len */ -export class WebImplExample { - name = ''; -} diff --git a/cocos/core/pipeline/custom/web-pipeline.ts b/cocos/core/pipeline/custom/web-pipeline.ts index 51f9f4286a..1b6422a611 100644 --- a/cocos/core/pipeline/custom/web-pipeline.ts +++ b/cocos/core/pipeline/custom/web-pipeline.ts @@ -35,7 +35,6 @@ import { Model, Camera, SKYBOX_FLAG, Light, LightType, ShadowType, DirectionalLi import { legacyCC } from '../../global-exports'; import { LayoutGraphData } from './layout-graph'; import { Executor } from './executor'; -import { WebImplExample } from './web-pipeline-impl'; import { RenderWindow } from '../../renderer/core/render-window'; import { assert, macro } from '../../platform'; import { WebSceneTransversal } from './web-scene'; diff --git a/cocos/core/root.ts b/cocos/core/root.ts index bb90a8c26e..5553c059d8 100644 --- a/cocos/core/root.ts +++ b/cocos/core/root.ts @@ -39,7 +39,6 @@ import { RenderWindow, IRenderWindowInfo } from './renderer/core/render-window'; import { ColorAttachment, DepthStencilAttachment, RenderPassInfo, StoreOp, Device, Swapchain, Feature } from './gfx'; import { warnID } from './platform/debug'; import { Pipeline, PipelineRuntime } from './pipeline/custom/pipeline'; -import { createCustomPipeline } from './pipeline/custom'; import { Batcher2D } from '../2d/renderer/batcher-2d'; import { IPipelineEvent } from './pipeline/pipeline-event'; @@ -376,14 +375,15 @@ export class Root { //----------------------------------------------- // choose pipeline //----------------------------------------------- - if (this.usesCustomPipeline) { - this._customPipeline = createCustomPipeline(); + if (this.usesCustomPipeline && legacyCC.internal.createCustomPipeline) { + this._customPipeline = legacyCC.internal.createCustomPipeline(); isCreateDefaultPipeline = true; this._pipeline = this._customPipeline!; } else { this._classicPipeline = rppl; this._pipeline = this._classicPipeline; this._pipelineEvent = this._classicPipeline; + this._usesCustomPipeline = false; } if (!this._pipeline.activate(this._mainWindow!.swapchain)) { diff --git a/exports/custom-pipeline.ts b/exports/custom-pipeline.ts new file mode 100644 index 0000000000..36445bf55e --- /dev/null +++ b/exports/custom-pipeline.ts @@ -0,0 +1,4 @@ +import { createCustomPipeline } from '../cocos/core/pipeline/custom'; +import { legacyCC } from '../cocos/core/global-exports'; + +legacyCC.internal.createCustomPipeline = createCustomPipeline;