mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Update pipeline after scene loaded and before rendering (#17345)
This commit is contained in:
+10
-1
@@ -739,7 +739,16 @@ export class Director extends EventTarget {
|
||||
// 2. cclegacy.rendering is available
|
||||
// 3. The root node is created and uses custom pipeline
|
||||
if (macro.CUSTOM_PIPELINE_NAME !== '' && cclegacy.rendering && this._root && this._root.usesCustomPipeline) {
|
||||
this.on(Director.EVENT_BEFORE_RENDER, this.buildRenderPipeline, this);
|
||||
this.on(
|
||||
Director.EVENT_BEFORE_RENDER,
|
||||
this.buildRenderPipeline,
|
||||
this,
|
||||
);
|
||||
this.on(
|
||||
Director.EVENT_BEFORE_SCENE_LAUNCH,
|
||||
cclegacy.rendering.forceResizeAllWindows,
|
||||
cclegacy.rendering,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ function getCsmMainLightViewport(
|
||||
|
||||
class PipelineConfigs {
|
||||
isWeb = false;
|
||||
isWebGPU = false;
|
||||
isMobile = false;
|
||||
isHDR = false;
|
||||
useFloatOutput = false;
|
||||
@@ -97,16 +98,13 @@ class PipelineConfigs {
|
||||
platform = new Vec4(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
function isWebGPU() {
|
||||
return (cclegacy.WebGPUDevice && cclegacy.director.root.device instanceof cclegacy.WebGPUDevice);
|
||||
}
|
||||
|
||||
function setupPipelineConfigs(
|
||||
ppl: rendering.BasicPipeline,
|
||||
configs: PipelineConfigs,
|
||||
): void {
|
||||
const sampleFeature = FormatFeatureBit.SAMPLED_TEXTURE | FormatFeatureBit.LINEAR_FILTER;
|
||||
configs.isWeb = !sys.isNative;
|
||||
configs.isWebGPU = (cclegacy.WebGPUDevice && cclegacy.director.root.device instanceof cclegacy.WebGPUDevice);
|
||||
configs.isMobile = sys.isMobile;
|
||||
configs.isHDR = ppl.pipelineSceneData.isHDR; // Has tone mapping
|
||||
configs.useFloatOutput = ppl.getMacroBool('CC_USE_FLOAT_OUTPUT');
|
||||
@@ -819,7 +817,9 @@ if (rendering) {
|
||||
for (let level = 0; level !== csmLevel; ++level) {
|
||||
getCsmMainLightViewport(light, width, height, level, this._viewport, this._configs.screenSpaceSignY);
|
||||
const queue = pass.addQueue(QueueHint.NONE, 'shadow-caster');
|
||||
isWebGPU() || queue.setViewport(this._viewport);
|
||||
if (!this._configs.isWebGPU) { // Temporary workaround for WebGPU
|
||||
queue.setViewport(this._viewport);
|
||||
}
|
||||
queue
|
||||
.addScene(camera, SceneFlags.OPAQUE | SceneFlags.MASK | SceneFlags.SHADOW_CASTER)
|
||||
.useLightFrustum(light, level);
|
||||
|
||||
Reference in New Issue
Block a user