From dda764eb2103efbee01b52d1a652f04cab841ff1 Mon Sep 17 00:00:00 2001 From: hyde zhou Date: Tue, 30 Jul 2024 13:42:05 +0800 Subject: [PATCH] add post process culling (#17452) * add post process culling * disable post-process by default * remove post process builder * cleanup * backward compatible --- cc.config.json | 28 +++++++++++-------- cocos/rendering/custom/index.jsb.ts | 8 ------ cocos/rendering/custom/index.ts | 8 ------ .../post-process/components/post-process.ts | 1 - cocos/rendering/post-process/index.ts | 1 + editor/engine-features/render-config.json | 6 ++++ editor/engine-features/schema.json | 6 ++++ editor/i18n/en/localization.js | 4 +++ editor/i18n/zh/localization.js | 4 +++ exports/custom-pipeline-post-process.ts | 3 ++ exports/custom-pipeline.ts | 2 -- typedoc-index.ts | 1 + 12 files changed, 42 insertions(+), 30 deletions(-) create mode 100644 exports/custom-pipeline-post-process.ts diff --git a/cc.config.json b/cc.config.json index 6a2dcb439d..cf1dcf0bd2 100644 --- a/cc.config.json +++ b/cc.config.json @@ -190,6 +190,20 @@ "custom-pipeline": { "modules": ["custom-pipeline"], "dependentAssets": [ + "6a2d0734-bd9e-4ddf-946e-caa52498cb75" + ] + }, + "custom-pipeline-builtin-scripts": { + "modules": [], + "dependentScripts": [ + "ff9b0199-ce04-4cfe-86cc-6c719f08d6e4", + "de1c2107-70c8-4021-8459-6399f24d01c6", + "cbf30902-517f-40dc-af90-a550bac27cf1" + ] + }, + "custom-pipeline-post-process": { + "modules": ["custom-pipeline-post-process"], + "dependentAssets":[ "15049ccd-4dd7-451e-a8ae-af66735c929e", "521c5f6e-1a26-42e2-8108-4400c912d9bf", "4c3ce6de-e6d1-47f7-aa36-36b9b58f72d3", @@ -204,17 +218,9 @@ "45e7c0c8-2699-4912-b45f-d42bb8384189", "84ac6f69-3086-455a-86a4-561da8ee710b", "5c601d96-e4c7-4698-991b-7ee674b11079", - "bf0a6d94-58f0-4ad2-bdf2-c4a31c7dd856", - "6a2d0734-bd9e-4ddf-946e-caa52498cb75" - ] - }, - "custom-pipeline-builtin-scripts": { - "modules": [], - "dependentScripts": [ - "ff9b0199-ce04-4cfe-86cc-6c719f08d6e4", - "de1c2107-70c8-4021-8459-6399f24d01c6", - "cbf30902-517f-40dc-af90-a550bac27cf1" - ] + "bf0a6d94-58f0-4ad2-bdf2-c4a31c7dd856" + ], + "dependentModules": ["custom-pipeline"] }, "legacy-pipeline": { "modules": ["legacy-pipeline"], diff --git a/cocos/rendering/custom/index.jsb.ts b/cocos/rendering/custom/index.jsb.ts index b1e285684f..f6bda48306 100644 --- a/cocos/rendering/custom/index.jsb.ts +++ b/cocos/rendering/custom/index.jsb.ts @@ -26,7 +26,6 @@ declare const render: any; import { Pipeline, PipelineBuilder, RenderingModule } from './pipeline'; import { Device } from '../../gfx'; -import { PostProcessBuilder } from '../post-process/post-process-builder'; import { forceResizeAllWindows } from './framework'; export * from './types'; @@ -61,13 +60,6 @@ export function getCustomPipeline (name: string): PipelineBuilder { return builder; } -function addCustomBuiltinPipelines (map: Map) { - map.set('Forward', new PostProcessBuilder()); - map.set('Custom', new PostProcessBuilder()); -} - -addCustomBuiltinPipelines(customPipelineBuilderMap); - export function init (device: Device, arrayBuffer: ArrayBuffer | null) { if (arrayBuffer) { _renderModule = render.Factory.init(device, arrayBuffer); diff --git a/cocos/rendering/custom/index.ts b/cocos/rendering/custom/index.ts index a254abe72a..9713ed5149 100644 --- a/cocos/rendering/custom/index.ts +++ b/cocos/rendering/custom/index.ts @@ -31,7 +31,6 @@ import { WebProgramLibrary } from './web-program-library'; import { Device } from '../../gfx'; import { initializeLayoutGraphData, terminateLayoutGraphData, getCustomPassID, getCustomPhaseID, getCustomSubpassID } from './layout-graph-utils'; import { ProgramLibrary } from './private'; -import { PostProcessBuilder } from '../post-process/post-process-builder'; import { forceResizeAllWindows } from './framework'; let _pipeline: WebPipeline | null = null; @@ -73,13 +72,6 @@ export function getCustomPipeline (name: string): PipelineBuilder { return builder; } -function addCustomBuiltinPipelines (map: Map): void { - map.set('Forward', new PostProcessBuilder()); - map.set('Custom', new PostProcessBuilder()); -} - -addCustomBuiltinPipelines(customPipelineBuilderMap); - export function init (device: Device, arrayBuffer: ArrayBuffer | null): void { if (arrayBuffer) { const readBinaryData = new BinaryInputArchive(arrayBuffer); diff --git a/cocos/rendering/post-process/components/post-process.ts b/cocos/rendering/post-process/components/post-process.ts index dc28476610..38e65c35ef 100644 --- a/cocos/rendering/post-process/components/post-process.ts +++ b/cocos/rendering/post-process/components/post-process.ts @@ -1,7 +1,6 @@ import { EDITOR } from 'internal:constants'; import { property, serializable } from '../../../core/data/class-decorator'; import { ccclass, disallowMultiple, executeInEditMode, help, range, slide, tooltip } from '../../../core/data/decorators'; -import { Director, director } from '../../../game'; import { Component } from '../../../scene-graph'; import { PostProcessSetting } from './post-process-setting'; diff --git a/cocos/rendering/post-process/index.ts b/cocos/rendering/post-process/index.ts index 255d537bd8..1d8db87df6 100644 --- a/cocos/rendering/post-process/index.ts +++ b/cocos/rendering/post-process/index.ts @@ -6,4 +6,5 @@ export * from './components'; export * from './passes'; export * from './post-process-builder'; +setCustomPipeline('Forward', new PostProcessBuilder()); setCustomPipeline('Custom', new PostProcessBuilder()); diff --git a/editor/engine-features/render-config.json b/editor/engine-features/render-config.json index 1a8a2d53c8..82743b237c 100644 --- a/editor/engine-features/render-config.json +++ b/editor/engine-features/render-config.json @@ -279,6 +279,12 @@ "default": true, "enginePlugin": false }, + "custom-pipeline-post-process": { + "default": false, + "label": "i18n:ENGINE.features.custom_pipeline_post_process.label", + "description": "i18n:ENGINE.features.custom_pipeline_post_process.description", + "enginePlugin": false + }, "legacy-pipeline": { "default": false, "enginePlugin": false diff --git a/editor/engine-features/schema.json b/editor/engine-features/schema.json index 99b2f14e7b..7ec9a2c716 100644 --- a/editor/engine-features/schema.json +++ b/editor/engine-features/schema.json @@ -80,6 +80,9 @@ "custom-pipeline": { "$ref": "#/definitions/IFeatureItem" }, + "custom-pipeline-post-process": { + "$ref": "#/definitions/IFeatureItem" + }, "legacy-pipeline": { "$ref": "#/definitions/IFeatureItem" }, @@ -260,6 +263,9 @@ "custom-pipeline": { "$ref": "#/definitions/BaseItem" }, + "custom-pipeline-post-process": { + "$ref": "#/definitions/BaseItem" + }, "legacy-pipeline": { "$ref": "#/definitions/BaseItem" }, diff --git a/editor/i18n/en/localization.js b/editor/i18n/en/localization.js index cbe9739aa7..9d5c57fdf6 100755 --- a/editor/i18n/en/localization.js +++ b/editor/i18n/en/localization.js @@ -1108,6 +1108,10 @@ module.exports = link(mixin({ label: "Custom Render Pipeline (Beta)", description: "Enable custom render pipeline", }, + custom_pipeline_post_process: { + label: "Custom Render Pipeline Post Process (Deprecated)", + description: "Enable custom render pipeline post process", + }, legacy_pipeline: { label: "Legacy Render Pipeline (Deprecated)", description: "Enable legacy render pipeline", diff --git a/editor/i18n/zh/localization.js b/editor/i18n/zh/localization.js index c30385b0ee..151b8869a6 100755 --- a/editor/i18n/zh/localization.js +++ b/editor/i18n/zh/localization.js @@ -1083,6 +1083,10 @@ module.exports = link(mixin({ label: "自定义渲染管线 (Beta)", description: "启用自定义渲染管线。", }, + custom_pipeline_post_process: { + label: "自定义渲染管线的后处理模块 (Deprecated)", + description: "启用自定义渲染管线的后处理模块", + }, legacy_pipeline: { label: "废弃渲染管线 (Deprecated)", description: "启用废弃渲染管线。", diff --git a/exports/custom-pipeline-post-process.ts b/exports/custom-pipeline-post-process.ts new file mode 100644 index 0000000000..5a1b9a0944 --- /dev/null +++ b/exports/custom-pipeline-post-process.ts @@ -0,0 +1,3 @@ +import * as postProcess from '../cocos/rendering/post-process'; + +export { postProcess }; diff --git a/exports/custom-pipeline.ts b/exports/custom-pipeline.ts index d3cfd957dd..5b120df554 100644 --- a/exports/custom-pipeline.ts +++ b/exports/custom-pipeline.ts @@ -1,8 +1,6 @@ import { legacyCC } from '../cocos/core/global-exports'; import * as rendering from '../cocos/rendering/custom'; -import * as postProcess from '../cocos/rendering/post-process'; export { rendering }; -export { postProcess }; legacyCC.rendering = rendering; diff --git a/typedoc-index.ts b/typedoc-index.ts index 1ab7aa8efa..f5f38d1b34 100644 --- a/typedoc-index.ts +++ b/typedoc-index.ts @@ -6,6 +6,7 @@ export * from './exports/animation'; export * from './exports/audio'; export * from './exports/base'; export * from './exports/custom-pipeline'; +export * from './exports/custom-pipeline-post-process'; export * from './exports/legacy-pipeline'; export * from './exports/dragon-bones'; export * from './exports/geometry-renderer';