Skip to content

Commit

Permalink
Merge branch 'v3.8.4' into v3.8.4-pipeline-reflection-probe
Browse files Browse the repository at this point in the history
  • Loading branch information
star-e committed Sep 4, 2024
2 parents ec9b14e + ef76162 commit 15e41e2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 17 deletions.
57 changes: 40 additions & 17 deletions cocos/rendering/custom/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,18 +486,6 @@ class DescBuffManager {

const buffsMap: Map<string, DescBuffManager> = new Map();
const currBindBuffs: Map<string, number> = new Map();
function updateGlobalDescBuffer (blockId: number, sceneId: number, idxRD: number, vals: number[], setData: DescriptorSetData): void {
const bindId = getDescBinding(blockId, setData);
if (bindId === -1) { return; }
const descKey = `${blockId}${bindId}${idxRD}${sceneId}`;
currBindBuffs.set(descKey, bindId);
let currDescBuff = buffsMap.get(descKey);
if (!currDescBuff) {
buffsMap.set(descKey, new DescBuffManager(vals.length * 4, 2));
currDescBuff = buffsMap.get(descKey);
}
currDescBuff!.updateData(vals);
}

const layouts: Map<string, DescriptorSetData> = new Map();
export function getDescriptorSetDataFromLayout (layoutName: string): DescriptorSetData | undefined {
Expand Down Expand Up @@ -591,6 +579,43 @@ function addConstantBuffer (block: string, layout: string): number[] | null {
uniformBlockMap.set(block, buffers);
return buffers;
}

function updateGlobalDescBuffer (descKey: string, vals: number[]): void {
let currDescBuff = buffsMap.get(descKey);
if (!currDescBuff) {
buffsMap.set(descKey, new DescBuffManager(vals.length * 4, 2));
currDescBuff = buffsMap.get(descKey);
}
currDescBuff!.updateData(vals);
}

function updateConstantBlock (
constantBuff: ConstantBlockInfo,
data: number[],
descriptorSetData: DescriptorSetData,
sceneId: number,
idxRD: number,
): void {
const blockId = constantBuff.blockId;
const buffer = constantBuff.buffer;
const isImparity = copyToConstantBuffer(buffer, data, constantBuff.offset);
const bindId = getDescBinding(blockId, descriptorSetData);
const desc = descriptorSetData.descriptorSet!;
if (isImparity || !desc.getBuffer(bindId) && bindId !== -1) {
const descKey = `${blockId}${bindId}${idxRD}${sceneId}`;
currBindBuffs.set(descKey, bindId);
updateGlobalDescBuffer(descKey, buffer);
}
}

function updateDefaultConstantBlock (blockId: number, sceneId: number, idxRD: number, vals: number[], setData: DescriptorSetData): void {
const bindId = getDescBinding(blockId, setData);
if (bindId === -1) { return; }
const descKey = `${blockId}${bindId}${idxRD}${sceneId}`;
currBindBuffs.set(descKey, bindId);
updateGlobalDescBuffer(descKey, vals);
}

export function updatePerPassUBO (layout: string, sceneId: number, idxRD: number, user: RenderData): void {
const constantMap = user.constants;
const samplers = user.samplers;
Expand All @@ -612,20 +637,18 @@ export function updatePerPassUBO (layout: string, sceneId: number, idxRD: number
if (offset === -1) {
// Although the current uniformMem does not belong to the current uniform block,
// it does not mean that it should not be bound to the corresponding descriptor.
updateGlobalDescBuffer(blockId, sceneId, idxRD, constantBuff, descriptorSetData);
updateDefaultConstantBlock(blockId, sceneId, idxRD, constantBuff, descriptorSetData);
continue;
}
constantBlockMap.set(key, new ConstantBlockInfo());
constantBlock = constantBlockMap.get(key)!;
constantBlock.buffer = constantBuff;
constantBlock.blockId = blockId;
constantBlock.offset = offset;
const isImparity = copyToConstantBuffer(constantBuff, data, offset);
if (isImparity) updateGlobalDescBuffer(blockId, sceneId, idxRD, constantBuff, descriptorSetData);
updateConstantBlock(constantBlock, data, descriptorSetData, sceneId, idxRD);
}
} else {
const isImparity = copyToConstantBuffer(constantBlock.buffer, data, constantBlock.offset);
if (isImparity) updateGlobalDescBuffer(constantBlock.blockId, sceneId, idxRD, constantBlock.buffer, descriptorSetData);
updateConstantBlock(constantBlock, data, descriptorSetData, sceneId, idxRD);
}
}

Expand Down
7 changes: 7 additions & 0 deletions editor/engine-features/render-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@
"enginePlugin": false,
"category": "animation"
},
"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,
"hidden": true
},
"render-pipeline": {
"label": "i18n:ENGINE.features.render-pipeline.label",
"description": "i18n:ENGINE.features.render-pipeline.description",
Expand Down

0 comments on commit 15e41e2

Please sign in to comment.