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

Fix the issue where post-processing modifications after rendering are ineffective. #17586

Merged
merged 2 commits into from
Aug 29, 2024
Merged
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
27 changes: 6 additions & 21 deletions cocos/rendering/custom/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,7 @@ export function getDescBindingFromName (bindingName: string): number {
return -1;
}

const uniformMap: Map<string, Float32Array> = new Map();
const buffHashMap: Map<Buffer, number> = new Map();
function numsHash (arr: number[]): number {
let hash = 0;
for (let i = 0; i < arr.length; i++) {
hash = hashCombineNum(arr[i], hash);
}
return hash;
}

const uniformMap: Map<Buffer, Float32Array> = new Map();
class DescBuffManager {
private buffers: Buffer[] = [];
private currBuffIdx: number = 0;
Expand All @@ -484,20 +475,14 @@ class DescBuffManager {
updateBuffer (bindId: number, vals: number[], layout: string, setData: DescriptorSetData): void {
const descriptorSet = setData.descriptorSet!;
const buffer = this.getCurrentBuffer();
const uniformKey = `${layout}${bindId}${this.currBuffIdx}`;
let currUniform = uniformMap.get(uniformKey);
const currHash = numsHash(vals);
let currUniform = uniformMap.get(buffer);
if (!currUniform) {
currUniform = new Float32Array(vals);
uniformMap.set(uniformKey, currUniform);
}
const destHash = buffHashMap.get(buffer);
if (destHash !== currHash) {
currUniform.set(vals);
buffer.update(currUniform);
bindGlobalDesc(descriptorSet, bindId, buffer);
buffHashMap.set(buffer, currHash);
uniformMap.set(buffer, currUniform);
}
currUniform.set(vals);
buffer.update(currUniform);
bindGlobalDesc(descriptorSet, bindId, buffer);
Comment on lines 475 to +485
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Buffer is now always updated, which may affect performance but ensures consistency

}
}

Expand Down
2 changes: 1 addition & 1 deletion cocos/rendering/custom/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ class PreRenderVisitor extends BaseRenderVisitor implements RenderGraphVisitor {
if (!this.rg.getValid(this.sceneID)) return;
const renderQueue = this.currQueue as DeviceRenderQueue;
const graphScene = context.pools.addGraphScene();
graphScene.init(null, value, -1);
graphScene.init(null, value, this.sceneID);
const renderScene = renderQueue.addScene(graphScene);
renderScene.preRecord();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,6 @@ export class BuiltinPipelineSettings extends Component {
return this._settings.bloom.threshold;
}

@property({
tooltip: 'i18n:bloom.intensity',
group: { id: 'Bloom', name: 'Bloom (PostProcessing)', style: 'section' },
type: CCFloat,
min: 0,
})
set bloomIntensity(value: number) {
this._settings.bloom.intensity = value;
}
Expand Down
Loading