From be8df4e59d44608913d02d6a755a269fe8819b41 Mon Sep 17 00:00:00 2001 From: hyde zhou Date: Fri, 19 Jul 2024 09:47:28 +0800 Subject: [PATCH] Add custom pipeline config. (#17390) --- EngineErrorMap.md | 4 ++++ cocos/game/game.ts | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/EngineErrorMap.md b/EngineErrorMap.md index 08e69e8e01f..8eec8780f23 100644 --- a/EngineErrorMap.md +++ b/EngineErrorMap.md @@ -3315,6 +3315,10 @@ Custom pipeline invalid render pass, program: %s. Please reimport all effects (M Custom pipeline invalid render phase, program: %s. Please reimport all effects (Menu->Developer->Refresh All Effect) and restart creator. +### 12109 + +custom-pipeline module not available. + ### 13100 Incorrect CCON magic. diff --git a/cocos/game/game.ts b/cocos/game/game.ts index 533a93c276a..8880e45ce79 100644 --- a/cocos/game/game.ts +++ b/cocos/game/game.ts @@ -770,8 +770,22 @@ export class Game extends EventTarget { return deviceManager.init(this.canvas, bindingMappingInfo); }) .then(() => { - if (cclegacy.rendering && !macro.CUSTOM_PIPELINE_NAME) { - macro.CUSTOM_PIPELINE_NAME = 'Builtin'; + const usesCustomPipeline = settings.querySettings( + Settings.Category.RENDERING, + 'customPipeline', + ); + if (usesCustomPipeline) { + if (!cclegacy.rendering) { + errorID(12109); + return; + } + if (!macro.CUSTOM_PIPELINE_NAME) { + // If custom pipeline is used, but the name is not set, use the default name + macro.CUSTOM_PIPELINE_NAME = 'Builtin'; + } + } else { + // If custom pipeline is not used, disable custom-pipeline module + cclegacy.rendering = undefined; } assetManager.init(); builtinResMgr.init();