Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address the issue where the post-processing effects of the new pipeline are unusable. #17568

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cocos/rendering/custom/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ export function updatePerPassUBO (layout: string, sceneId: number, user: RenderD
const bindId = getDescBinding(key, descriptorSetData);
if (bindId === -1) { continue; }
const tex = descriptorSet.getTexture(bindId);
if (!tex || value !== webPip.defaultShadowTexture
if (tex !== value
// @ts-ignore
|| (!tex.gpuTexture && !(tex.gpuTextureView && tex.gpuTextureView.gpuTexture))) {
bindGlobalDesc(descriptorSet, bindId, value);
Expand All @@ -654,7 +654,7 @@ export function updatePerPassUBO (layout: string, sceneId: number, user: RenderD
const bindId = getDescBinding(key, descriptorSetData);
if (bindId === -1) { continue; }
const sampler = descriptorSet.getSampler(bindId);
if (!sampler || value !== webPip.defaultSampler) {
if (sampler !== value) {
bindGlobalDesc(descriptorSet, bindId, value);
}
}
Expand Down
46 changes: 25 additions & 21 deletions cocos/rendering/custom/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,10 +675,11 @@ class RenderPassLayoutInfo {
protected _layoutID = 0;
protected _vertID = -1;
protected _stage: RenderStageData | null = null;
protected _layout: PipelineLayoutData;
protected _inputName: string;
protected _layout!: PipelineLayoutData;
protected _inputName!: string;
protected _descriptorSet: DescriptorSet | null = null;
constructor (layoutId: number, vertId: number, input: [string, ComputeView[]]) {
init (layoutId: number, vertId: number, input: [string, ComputeView[]]): void {
this._descriptorSet = null;
this._inputName = input[0];
this._layoutID = layoutId;
this._vertID = vertId;
Expand Down Expand Up @@ -820,13 +821,6 @@ class DeviceRenderPass implements RecordingInterface {
let depthTex: Texture | null = null;
let swapchain: Swapchain | null = null;
let framebuffer: Framebuffer | null = null;
for (const cv of passInfo.pass.computeViews) {
this._applyRenderLayout(cv);
}
// update the layout descriptorSet
if (this.renderLayout && this.renderLayout.descriptorSet) {
this.renderLayout.descriptorSet.update();
}
for (const [resName, rasterV] of passInfo.pass.rasterViews) {
let resTex = context.deviceTextures.get(resName);
if (!resTex) {
Expand Down Expand Up @@ -920,6 +914,15 @@ class DeviceRenderPass implements RecordingInterface {
get deviceQueues (): Map<number, DeviceRenderQueue> { return this._deviceQueues; }
get rasterPassInfo (): RasterPassInfo { return this._rasterInfo; }
get viewport (): Viewport | null { return this._viewport; }
setRenderLayoutView (): void {
for (const cv of this.rasterPassInfo.pass.computeViews) {
this._applyRenderLayout(cv);
}
// update the layout descriptorSet
if (this.renderLayout && this.renderLayout.descriptorSet) {
this.renderLayout.descriptorSet.update();
}
}
visitResource (resName: string): void {
const resourceGraph = context.resourceGraph;
const vertId = resourceGraph.vertex(resName);
Expand All @@ -938,7 +941,8 @@ class DeviceRenderPass implements RecordingInterface {
const layoutGraph = context.layoutGraph;
const stageId = layoutGraph.locateChild(layoutGraph.N, stageName);
if (stageId !== 0xFFFFFFFF) {
this._layout = new RenderPassLayoutInfo(stageId, this.rasterPassInfo.id, input);
this._layout = context.pools.addRenderPassLayout();
this._layout.init(stageId, this.rasterPassInfo.id, input);
}
}
}
Expand Down Expand Up @@ -1045,14 +1049,6 @@ class DeviceRenderPass implements RecordingInterface {
const currFramebuffer = this._framebuffer;
const currFBDepthTex = currFramebuffer.depthStencilTexture;
let depTexture = currFramebuffer ? currFBDepthTex : null;
for (const cv of this._rasterInfo.pass.computeViews) {
this._applyRenderLayout(cv);
}
// update the layout descriptorSet
if (this.renderLayout && this.renderLayout.descriptorSet) {
this.renderLayout.descriptorSet.update();
}

const resGraph = context.resourceGraph;
const currentWidth = currFramebuffer ? currFramebuffer.width : 0;
const currentHeight = currFramebuffer ? currFramebuffer.height : 0;
Expand Down Expand Up @@ -1208,7 +1204,8 @@ class DeviceComputePass implements RecordingInterface {
const layoutGraph = context.layoutGraph;
const stageId = layoutGraph.locateChild(layoutGraph.N, stageName);
if (stageId !== 0xFFFFFFFF) {
this._layout = new RenderPassLayoutInfo(stageId, this._computeInfo.id, input);
this._layout = context.pools.addRenderPassLayout();
this._layout.init(stageId, this._computeInfo.id, input);
}
}
}
Expand Down Expand Up @@ -1331,7 +1328,7 @@ class DeviceRenderScene implements RecordingInterface {
const queueId = this._currentQueue.queueId;
const queueRenderData = context.renderGraph.getData(queueId)!;
this._updateGlobal(queueRenderData, this.graphScene.sceneID);

devicePass.setRenderLayoutView();
this._currentQueue.isUpdateUBO = true;

const batches = this.camera!.scene!.batches;
Expand Down Expand Up @@ -1409,6 +1406,7 @@ class DeviceRenderScene implements RecordingInterface {
this._updateGlobal(queueRenderData, sceneId);
const sceneRenderData = context.renderGraph.getData(sceneId)!;
if (sceneRenderData) this._updateGlobal(sceneRenderData, sceneId);
devicePass.setRenderLayoutView();
this._currentQueue.isUpdateUBO = true;
}

Expand Down Expand Up @@ -1467,6 +1465,7 @@ class ExecutorPools {
this.deviceScenePool = new RecyclePool<DeviceRenderScene>((): DeviceRenderScene => new DeviceRenderScene(), 16);
this.computeQueuePool = new RecyclePool<DeviceComputeQueue>((): DeviceComputeQueue => new DeviceComputeQueue(), 16);
this.graphScenePool = new RecyclePool<GraphScene>((): GraphScene => new GraphScene(), 16);
this.renderPassLayoutPool = new RecyclePool<RenderPassLayoutInfo>((): RenderPassLayoutInfo => new RenderPassLayoutInfo(), 16);
this.rasterPassInfoPool = new RecyclePool<RasterPassInfo>((): RasterPassInfo => new RasterPassInfo(), 16);
this.computePassInfoPool = new RecyclePool<ComputePassInfo>((): ComputePassInfo => new ComputePassInfo(), 16);
this.passPool = new RecyclePool<IRenderPass>((): { priority: number; hash: number; depth: number; shaderId: number; subModel: any; passIdx: number; } => ({
Expand All @@ -1478,6 +1477,9 @@ class ExecutorPools {
passIdx: 0,
}), 64);
}
addRenderPassLayout (): RenderPassLayoutInfo {
return this.renderPassLayoutPool.add();
}
addDeviceQueue (): DeviceRenderQueue {
return this.deviceQueuePool.add();
}
Expand All @@ -1502,6 +1504,7 @@ class ExecutorPools {
this.graphScenePool.reset();
this.computePassInfoPool.reset();
this.deviceScenePool.reset();
this.renderPassLayoutPool.reset();
}
readonly deviceQueuePool: RecyclePool<DeviceRenderQueue>;
readonly computeQueuePool: RecyclePool<DeviceComputeQueue>;
Expand All @@ -1510,6 +1513,7 @@ class ExecutorPools {
readonly rasterPassInfoPool: RecyclePool<RasterPassInfo>;
readonly computePassInfoPool: RecyclePool<ComputePassInfo>;
readonly deviceScenePool: RecyclePool<DeviceRenderScene>;
readonly renderPassLayoutPool: RecyclePool<RenderPassLayoutInfo>;
}

const vbData = new Float32Array(4 * 4);
Expand Down
Loading