diff --git a/cocos/rendering/custom/layout-graph-editor.ts b/cocos/rendering/custom/layout-graph-editor.ts index c63fd128c41..1c81bc883fc 100644 --- a/cocos/rendering/custom/layout-graph-editor.ts +++ b/cocos/rendering/custom/layout-graph-editor.ts @@ -33,14 +33,14 @@ import { DescriptorBlockData, DescriptorBlockFlattened, DescriptorBlockIndex, - DescriptorData, DescriptorDB, DescriptorGroupBlock, DescriptorGroupBlockIndex, DescriptorSetData, + DescriptorData, DescriptorDB, DescriptorGroupBlockIndex, DescriptorSetData, DescriptorTypeOrder, LayoutGraph, LayoutGraphData, LayoutGraphDataValue, LayoutGraphValue, PipelineLayoutData, RenderPassType, RenderPhase, RenderPhaseData, RenderStageData, ShaderProgramData, } from './layout-graph'; import { getDescriptorTypeOrderName } from './layout-graph-names'; -import { ENABLE_SUBPASS, getOrCreateDescriptorID, sortDescriptorBlocks } from './layout-graph-utils'; +import { ENABLE_SUBPASS, getOrCreateDescriptorID, sortDescriptorBlocks, sortDescriptorGroupBlocks } from './layout-graph-utils'; import { AccessType, ParameterType, UpdateFrequency, } from './types'; @@ -585,10 +585,10 @@ export class LayoutGraphInfo { } return value; } - private getDescriptorGroupBlock (key: string, descriptorDB: DescriptorDB): DescriptorGroupBlock { + private getDescriptorGroupBlock (key: string, descriptorDB: DescriptorDB): DescriptorBlock { const value = descriptorDB.groupBlocks.get(key); if (value === undefined) { - const groupBlock: DescriptorGroupBlock = new DescriptorGroupBlock(); + const groupBlock: DescriptorBlock = new DescriptorBlock(); descriptorDB.groupBlocks.set(key, groupBlock); return groupBlock; } @@ -1043,6 +1043,164 @@ export class LayoutGraphInfo { } } } + private mergeDescriptorBlocks ( + passVisDB: VisibilityDB, + blocks: Map, + passDB: DescriptorDB, + ): number { + for (const [key0, block] of blocks) { + const index0: DescriptorBlockIndex = JSON.parse(key0); + if (index0.updateFrequency <= UpdateFrequency.PER_PHASE) { + continue; + } + const visIndex = new VisibilityIndex(index0.updateFrequency, index0.parameterType, index0.descriptorType); + const passVisBlock = passVisDB.getBlock(visIndex); + + for (const [name, d] of block.descriptors) { + const vis = passVisBlock.getVisibility(name); + let passBlock: DescriptorBlock; + if (vis === index0.visibility) { + passBlock = this.getDescriptorBlock(key0, passDB); + } else { + const index = new DescriptorBlockIndex( + index0.updateFrequency, + index0.parameterType, + index0.descriptorType, + vis, + ); + const key = JSON.stringify(index); + passBlock = this.getDescriptorBlock(key, passDB); + } + this.addDescriptor(passBlock, name, d.type); + if (index0.descriptorType !== DescriptorTypeOrder.UNIFORM_BUFFER) { + continue; + } + const b = block.uniformBlocks.get(name); + if (!b) { + error(`uniform block: ${name} not found`); + return 1; + } + this.addUniformBlock(passBlock, name, b); + } + } + return 0; + } + private mergeDescriptorGroupBlocks ( + passVisDB: VisibilityDB, + blocks: Map, + passDB: DescriptorDB, + ): number { + for (const [key0, block] of blocks) { + const index0: DescriptorGroupBlockIndex = JSON.parse(key0); + if (index0.updateFrequency <= UpdateFrequency.PER_PHASE) { + continue; + } + const visIndex = new VisibilityIndex(index0.updateFrequency, index0.parameterType, index0.descriptorType); + const passVisBlock = passVisDB.getBlock(visIndex); + + for (const [name, d] of block.descriptors) { + const vis = passVisBlock.getVisibility(name); + let passBlock: DescriptorBlock; + if (vis === index0.visibility) { + passBlock = this.getDescriptorGroupBlock(key0, passDB); + } else { + const index = new DescriptorGroupBlockIndex( + index0.updateFrequency, + index0.parameterType, + index0.descriptorType, + vis, + index0.accessType, + index0.viewDimension, + index0.sampleType, + index0.format, + ); + const key = JSON.stringify(index); + passBlock = this.getDescriptorGroupBlock(key, passDB); + } + this.addDescriptor(passBlock, name, d.type); + if (index0.descriptorType !== DescriptorTypeOrder.UNIFORM_BUFFER) { + continue; + } + const b = block.uniformBlocks.get(name); + if (!b) { + error(`uniform block: ${name} not found`); + return 1; + } + this.addUniformBlock(passBlock, name, b); + } + } + return 0; + } + private buildDescriptorBlocks ( + lg: LayoutGraph, + blocks: Map, + passID: number, + phaseDB: DescriptorDB, + phaseID: number, + ): number { + for (const [key, passBlock] of blocks) { + const index: DescriptorBlockIndex = JSON.parse(key); + if (index.updateFrequency !== UpdateFrequency.PER_PASS) { + error(`phase: ${lg.getName(phaseID)} update frequency is not PER_PASS`); + return 1; + } + if (passBlock.count === 0) { + error(`pass: ${lg.getName(passID)} count is 0`); + return 1; + } + if (passBlock.capacity !== passBlock.count) { + error(`pass: ${lg.getName(passID)} capacity does not equal count`); + return 1; + } + const phaseBlock = this.getDescriptorBlock(key, phaseDB); + phaseBlock.descriptors.clear(); + phaseBlock.uniformBlocks.clear(); + phaseBlock.capacity = passBlock.capacity; + phaseBlock.count = passBlock.count; + for (const [name, d] of passBlock.descriptors) { + phaseBlock.descriptors.set(name, d); + } + for (const [name, b] of passBlock.uniformBlocks) { + phaseBlock.uniformBlocks.set(name, b); + } + } + return 0; + } + private buildDescriptorGroupBlocks ( + lg: LayoutGraph, + blocks: Map, + passID: number, + phaseDB: DescriptorDB, + phaseID: number, + ): number { + for (const [key, passBlock] of blocks) { + const index: DescriptorGroupBlockIndex = JSON.parse(key); + if (index.updateFrequency !== UpdateFrequency.PER_PASS) { + error(`phase: ${lg.getName(phaseID)} update frequency is not PER_PASS`); + return 1; + } + if (passBlock.count === 0) { + error(`pass: ${lg.getName(passID)} count is 0`); + return 1; + } + if (passBlock.capacity !== passBlock.count) { + error(`pass: ${lg.getName(passID)} capacity does not equal count`); + return 1; + } + const phaseBlock = this.getDescriptorGroupBlock(key, phaseDB); + phaseBlock.descriptors.clear(); + phaseBlock.uniformBlocks.clear(); + phaseBlock.capacity = passBlock.capacity; + phaseBlock.count = passBlock.count; + for (const [name, d] of passBlock.descriptors) { + phaseBlock.descriptors.set(name, d); + } + for (const [name, b] of passBlock.uniformBlocks) { + phaseBlock.uniformBlocks.set(name, b); + } + } + return 0; + } public build (): number { const lg = this.lg; const visMap = new Map(); @@ -1096,40 +1254,11 @@ export class LayoutGraphInfo { error(`pass: ${lg.getName(parentID)} has no visibility database`); return 1; } - for (const [key0, block] of phaseDB.blocks) { - const index0: DescriptorBlockIndex = JSON.parse(key0); - if (index0.updateFrequency <= UpdateFrequency.PER_PHASE) { - continue; - } - const visIndex = new VisibilityIndex(index0.updateFrequency, index0.parameterType, index0.descriptorType); - const passVisBlock = passVisDB.getBlock(visIndex); - - for (const [name, d] of block.descriptors) { - const vis = passVisBlock.getVisibility(name); - let passBlock: DescriptorBlock; - if (vis === index0.visibility) { - passBlock = this.getDescriptorBlock(key0, passDB); - } else { - const index = new DescriptorBlockIndex( - index0.updateFrequency, - index0.parameterType, - index0.descriptorType, - vis, - ); - const key = JSON.stringify(index); - passBlock = this.getDescriptorBlock(key, passDB); - } - this.addDescriptor(passBlock, name, d.type); - if (index0.descriptorType !== DescriptorTypeOrder.UNIFORM_BUFFER) { - continue; - } - const b = block.uniformBlocks.get(name); - if (!b) { - error(`uniform block: ${name} not found`); - return 1; - } - this.addUniformBlock(passBlock, name, b); - } + if (this.mergeDescriptorBlocks(passVisDB, phaseDB.blocks, passDB)) { + return 1; + } + if (this.mergeDescriptorGroupBlocks(passVisDB, phaseDB.groupBlocks, passDB)) { + return 1; } } // update pass @@ -1154,31 +1283,11 @@ export class LayoutGraphInfo { return 1; } const phaseDB = lg.getDescriptors(phaseID); - for (const [key, passBlock] of passDB.blocks) { - const index: DescriptorBlockIndex = JSON.parse(key); - if (index.updateFrequency !== UpdateFrequency.PER_PASS) { - error(`phase: ${lg.getName(phaseID)} update frequency is not PER_PASS`); - return 1; - } - if (passBlock.count === 0) { - error(`pass: ${lg.getName(passID)} count is 0`); - return 1; - } - if (passBlock.capacity !== passBlock.count) { - error(`pass: ${lg.getName(passID)} capacity does not equal count`); - return 1; - } - const phaseBlock = this.getDescriptorBlock(key, phaseDB); - phaseBlock.descriptors.clear(); - phaseBlock.uniformBlocks.clear(); - phaseBlock.capacity = passBlock.capacity; - phaseBlock.count = passBlock.count; - for (const [name, d] of passBlock.descriptors) { - phaseBlock.descriptors.set(name, d); - } - for (const [name, b] of passBlock.uniformBlocks) { - phaseBlock.uniformBlocks.set(name, b); - } + if (this.buildDescriptorBlocks(lg, passDB.blocks, passID, phaseDB, phaseID)) { + return 1; + } + if (this.buildDescriptorGroupBlocks(lg, passDB.groupBlocks, passID, phaseDB, phaseID)) { + return 1; } } } @@ -1271,6 +1380,29 @@ function buildLayoutGraphDataImpl (graph: LayoutGraph, builder: LayoutGraphBuild builder.reserveDescriptorBlock(v, index, flattened); } }); + + const flattenedGroupBlocks = Array.from(db.groupBlocks).sort(sortDescriptorGroupBlocks); + flattenedGroupBlocks.forEach((value: [string, DescriptorBlock]): void => { + const key = value[0]; + const block = value[1]; + const index: DescriptorGroupBlockIndex = JSON.parse(key); + if (index.updateFrequency > maxLevel || index.updateFrequency < minLevel) { + return; + } + const flattened = convertDescriptorBlock(block); + if (block.capacity === 0) { + error('block capacity is 0'); + return; + } + if (index.updateFrequency > UpdateFrequency.PER_BATCH) { + builder.addDescriptorGroupBlock(v, index, flattened); + for (let i = 0; i < flattened.uniformBlockNames.length; ++i) { + builder.addGroupUniformBlock(v, index, flattened.uniformBlockNames[i], flattened.uniformBlocks[i]); + } + } else { + builder.reserveDescriptorGroupBlock(v, index, flattened); + } + }); } } @@ -1337,6 +1469,15 @@ class LayoutGraphBuilder2 { } return data; } + private getDescriptorGroupData (ppl: PipelineLayoutData, rate: UpdateFrequency): DescriptorSetData { + const data = ppl.descriptorGroups.get(rate); + if (data === undefined) { + const newData = new DescriptorSetData(); + ppl.descriptorGroups.set(rate, newData); + return newData; + } + return data; + } addDescriptorBlock (nodeID: number, index: DescriptorBlockIndex, block: Readonly): void { if (block.capacity <= 0) { error('empty block'); @@ -1379,6 +1520,56 @@ class LayoutGraphBuilder2 { layout.samplerTextureCapacity += block.capacity; } } + addDescriptorGroupBlock (nodeID: number, index: DescriptorGroupBlockIndex, block: Readonly): void { + if (block.capacity <= 0) { + error('empty block'); + return; + } + if (block.descriptorNames.length !== block.descriptors.length) { + error('error descriptor'); + return; + } + if (block.uniformBlockNames.length !== block.uniformBlocks.length) { + error('error uniform'); + return; + } + if (!(index.updateFrequency >= UpdateFrequency.PER_INSTANCE + && index.updateFrequency <= UpdateFrequency.PER_PASS)) { + error('invalid update frequency'); + return; + } + + const lg = this.lg; + const ppl: PipelineLayoutData = lg.getLayout(nodeID); + const setData = this.getDescriptorGroupData(ppl, index.updateFrequency); + const layout = setData.descriptorSetLayoutData; + + const dstBlock = new DescriptorBlockData( + index.descriptorType, + index.visibility, + block.capacity, + index.accessType, + index.viewDimension, + index.sampleType, + index.format, + ); + dstBlock.offset = layout.capacity; + layout.descriptorBlocks.push(dstBlock); + for (let j = 0; j < block.descriptors.length; ++j) { + const name: string = block.descriptorNames[j]; + const d: Descriptor = block.descriptors[j]; + const nameID = getOrCreateDescriptorID(lg, name); + const data = new DescriptorData(nameID, d.type, d.count); + dstBlock.descriptors.push(data); + } + layout.capacity += block.capacity; + if (index.descriptorType === DescriptorTypeOrder.UNIFORM_BUFFER + || index.descriptorType === DescriptorTypeOrder.DYNAMIC_UNIFORM_BUFFER) { + layout.uniformBlockCapacity += block.capacity; + } else if (index.descriptorType === DescriptorTypeOrder.SAMPLER_TEXTURE) { + layout.samplerTextureCapacity += block.capacity; + } + } addUniformBlock (nodeID: number, index: DescriptorBlockIndex, name: string, uniformBlock: UniformBlock): void { const g: LayoutGraphData = this.lg; const ppl: PipelineLayoutData = g.getLayout(nodeID); @@ -1391,6 +1582,18 @@ class LayoutGraphBuilder2 { getOrCreateConstantID(g, member.name); } } + addGroupUniformBlock (nodeID: number, index: DescriptorGroupBlockIndex, name: string, uniformBlock: UniformBlock): void { + const g: LayoutGraphData = this.lg; + const ppl: PipelineLayoutData = g.getLayout(nodeID); + const setData = this.getDescriptorGroupData(ppl, index.updateFrequency); + const layout = setData.descriptorSetLayoutData; + const nameID = getOrCreateDescriptorID(g, name); + layout.uniformBlocks.set(nameID, uniformBlock); + // register constant names + for (const member of uniformBlock.members) { + getOrCreateConstantID(g, member.name); + } + } reserveDescriptorBlock (nodeID: number, index: DescriptorBlockIndex, block: DescriptorBlockFlattened): void { if (block.capacity <= 0) { error('empty block'); @@ -1412,6 +1615,35 @@ class LayoutGraphBuilder2 { layout.samplerTextureCapacity += block.capacity; } } + reserveDescriptorGroupBlock (nodeID: number, index: DescriptorGroupBlockIndex, block: DescriptorBlockFlattened): void { + if (block.capacity <= 0) { + error('empty block'); + return; + } + const g: LayoutGraphData = this.lg; + const ppl: PipelineLayoutData = g.getLayout(nodeID); + const setData = this.getDescriptorGroupData(ppl, index.updateFrequency); + const layout = setData.descriptorSetLayoutData; + + const dstBlock = new DescriptorBlockData( + index.descriptorType, + index.visibility, + block.capacity, + index.accessType, + index.viewDimension, + index.sampleType, + index.format, + ); + dstBlock.offset = layout.capacity; + layout.descriptorBlocks.push(dstBlock); + layout.capacity += block.capacity; + if (index.descriptorType === DescriptorTypeOrder.UNIFORM_BUFFER + || index.descriptorType === DescriptorTypeOrder.DYNAMIC_UNIFORM_BUFFER) { + layout.uniformBlockCapacity += block.capacity; + } else if (index.descriptorType === DescriptorTypeOrder.SAMPLER_TEXTURE) { + layout.samplerTextureCapacity += block.capacity; + } + } compile (): number { // console.debug(this.print()); return 0; diff --git a/cocos/rendering/custom/layout-graph-utils.ts b/cocos/rendering/custom/layout-graph-utils.ts index 8fe3a5d9900..26ecb3411dd 100644 --- a/cocos/rendering/custom/layout-graph-utils.ts +++ b/cocos/rendering/custom/layout-graph-utils.ts @@ -28,6 +28,7 @@ import { assert, error, warn } from '../../core'; import { DescriptorSetInfo, DescriptorSetLayout, DescriptorSetLayoutBinding, DescriptorSetLayoutInfo, DescriptorType, Device, Feature, Format, FormatFeatureBit, GetTypeSize, PipelineLayout, PipelineLayoutInfo, ShaderStageFlagBit, Type, Uniform, UniformBlock } from '../../gfx'; import { UBOForwardLightEnum, UBOSkinning } from '../define'; import type { + DescriptorGroupBlockIndex, LayoutGraphData, PipelineLayoutData, RenderPhaseData, } from './layout-graph'; @@ -181,6 +182,29 @@ export function sortDescriptorBlocks (lhs: [string, T], rhs: [string, T]): nu return lhsValue - rhsValue; } +export function sortDescriptorGroupBlocks (lhs: [string, T], rhs: [string, T]): number { + const lhsIndex: DescriptorGroupBlockIndex = JSON.parse(lhs[0]); + const rhsIndex: DescriptorGroupBlockIndex = JSON.parse(rhs[0]); + + const lhsValue = lhsIndex.updateFrequency * 1000000000 + + lhsIndex.parameterType * 100000000 + + lhsIndex.descriptorType * 10000000 + + lhsIndex.visibility * 1000000 + + lhsIndex.accessType * 100000 + + lhsIndex.viewDimension * 10000 + + lhsIndex.sampleType * 1000 + + lhsIndex.format; + const rhsValue = rhsIndex.updateFrequency * 1000000000 + + rhsIndex.parameterType * 100000000 + + rhsIndex.descriptorType * 10000000 + + rhsIndex.visibility * 1000000 + + rhsIndex.accessType * 100000 + + rhsIndex.viewDimension * 10000 + + rhsIndex.sampleType * 1000 + + rhsIndex.format; + return lhsValue - rhsValue; +} + // get descriptor nameID from name export function getOrCreateDescriptorID (lg: LayoutGraphData, name: string): number { const nameID = lg.attributeIndex.get(name); diff --git a/cocos/rendering/custom/layout-graph.ts b/cocos/rendering/custom/layout-graph.ts index c34546162d4..cb68776f143 100644 --- a/cocos/rendering/custom/layout-graph.ts +++ b/cocos/rendering/custom/layout-graph.ts @@ -137,26 +137,13 @@ export class DescriptorGroupBlockIndex { declare format: Format; } -export class DescriptorGroupBlock { - reset (): void { - this.descriptors.clear(); - this.uniformBlocks.clear(); - this.capacity = 0; - this.count = 0; - } - readonly descriptors: Map = new Map(); - readonly uniformBlocks: Map = new Map(); - capacity = 0; - count = 0; -} - export class DescriptorDB { reset (): void { this.blocks.clear(); this.groupBlocks.clear(); } readonly blocks: Map = new Map(); - readonly groupBlocks: Map = new Map(); + readonly groupBlocks: Map = new Map(); } export class RenderPhase { @@ -1013,7 +1000,6 @@ export class LayoutGraphObjectPool { this.dbf.reset(); // DescriptorBlockFlattened this.dbi.reset(); // DescriptorBlockIndex this.dgbi.reset(); // DescriptorGroupBlockIndex - this.dgb.reset(); // DescriptorGroupBlock this.dd.reset(); // DescriptorDB this.rp.reset(); // RenderPhase this.lg.reset(); // LayoutGraph @@ -1084,11 +1070,6 @@ export class LayoutGraphObjectPool { v.format = format; return v; } - createDescriptorGroupBlock (): DescriptorGroupBlock { - const v = this.dgb.add(); // DescriptorGroupBlock - v.reset(); - return v; - } createDescriptorDB (): DescriptorDB { const v = this.dd.add(); // DescriptorDB v.reset(); @@ -1207,7 +1188,6 @@ export class LayoutGraphObjectPool { private readonly dbf: RecyclePool = createPool(DescriptorBlockFlattened); private readonly dbi: RecyclePool = createPool(DescriptorBlockIndex); private readonly dgbi: RecyclePool = createPool(DescriptorGroupBlockIndex); - private readonly dgb: RecyclePool = createPool(DescriptorGroupBlock); private readonly dd: RecyclePool = createPool(DescriptorDB); private readonly rp: RecyclePool = createPool(RenderPhase); private readonly lg: RecyclePool = createPool(LayoutGraph); @@ -1360,51 +1340,16 @@ export function loadDescriptorGroupBlockIndex (a: InputArchive, v: DescriptorGro v.format = a.n(); } -export function saveDescriptorGroupBlock (a: OutputArchive, v: DescriptorGroupBlock): void { - a.n(v.descriptors.size); // Map - for (const [k1, v1] of v.descriptors) { - a.s(k1); - saveDescriptor(a, v1); - } - a.n(v.uniformBlocks.size); // Map - for (const [k1, v1] of v.uniformBlocks) { - a.s(k1); - saveUniformBlock(a, v1); - } - a.n(v.capacity); - a.n(v.count); -} - -export function loadDescriptorGroupBlock (a: InputArchive, v: DescriptorGroupBlock): void { - let sz = 0; - sz = a.n(); // Map - for (let i1 = 0; i1 !== sz; ++i1) { - const k1 = a.s(); - const v1 = new Descriptor(); - loadDescriptor(a, v1); - v.descriptors.set(k1, v1); - } - sz = a.n(); // Map - for (let i1 = 0; i1 !== sz; ++i1) { - const k1 = a.s(); - const v1 = new UniformBlock(); - loadUniformBlock(a, v1); - v.uniformBlocks.set(k1, v1); - } - v.capacity = a.n(); - v.count = a.n(); -} - export function saveDescriptorDB (a: OutputArchive, v: DescriptorDB): void { a.n(v.blocks.size); // Map for (const [k1, v1] of v.blocks) { saveDescriptorBlockIndex(a, JSON.parse(k1) as DescriptorBlockIndex); saveDescriptorBlock(a, v1); } - a.n(v.groupBlocks.size); // Map + a.n(v.groupBlocks.size); // Map for (const [k1, v1] of v.groupBlocks) { saveDescriptorGroupBlockIndex(a, JSON.parse(k1) as DescriptorGroupBlockIndex); - saveDescriptorGroupBlock(a, v1); + saveDescriptorBlock(a, v1); } } @@ -1418,12 +1363,12 @@ export function loadDescriptorDB (a: InputArchive, v: DescriptorDB): void { loadDescriptorBlock(a, v1); v.blocks.set(JSON.stringify(k1), v1); } - sz = a.n(); // Map + sz = a.n(); // Map for (let i1 = 0; i1 !== sz; ++i1) { const k1 = new DescriptorGroupBlockIndex(); loadDescriptorGroupBlockIndex(a, k1); - const v1 = new DescriptorGroupBlock(); - loadDescriptorGroupBlock(a, v1); + const v1 = new DescriptorBlock(); + loadDescriptorBlock(a, v1); v.groupBlocks.set(JSON.stringify(k1), v1); } } diff --git a/native/cocos/renderer/pipeline/custom/LayoutGraphFwd.h b/native/cocos/renderer/pipeline/custom/LayoutGraphFwd.h index 5f4e968fa0f..2343f32e905 100644 --- a/native/cocos/renderer/pipeline/custom/LayoutGraphFwd.h +++ b/native/cocos/renderer/pipeline/custom/LayoutGraphFwd.h @@ -45,7 +45,6 @@ struct DescriptorBlock; struct DescriptorBlockFlattened; struct DescriptorBlockIndex; struct DescriptorGroupBlockIndex; -struct DescriptorGroupBlock; struct DescriptorDB; struct RenderStageTag; struct RenderPhaseTag; diff --git a/native/cocos/renderer/pipeline/custom/LayoutGraphNames.h b/native/cocos/renderer/pipeline/custom/LayoutGraphNames.h index 2ccb97f6a4a..1c2c69ffe4f 100644 --- a/native/cocos/renderer/pipeline/custom/LayoutGraphNames.h +++ b/native/cocos/renderer/pipeline/custom/LayoutGraphNames.h @@ -55,7 +55,6 @@ inline const char* getName(const DescriptorBlock& /*v*/) noexcept { return "Desc inline const char* getName(const DescriptorBlockFlattened& /*v*/) noexcept { return "DescriptorBlockFlattened"; } inline const char* getName(const DescriptorBlockIndex& /*v*/) noexcept { return "DescriptorBlockIndex"; } inline const char* getName(const DescriptorGroupBlockIndex& /*v*/) noexcept { return "DescriptorGroupBlockIndex"; } -inline const char* getName(const DescriptorGroupBlock& /*v*/) noexcept { return "DescriptorGroupBlock"; } inline const char* getName(const DescriptorDB& /*v*/) noexcept { return "DescriptorDB"; } inline const char* getName(const RenderStageTag& /*v*/) noexcept { return "RenderStage"; } inline const char* getName(const RenderPhaseTag& /*v*/) noexcept { return "RenderPhase"; } diff --git a/native/cocos/renderer/pipeline/custom/LayoutGraphSerialization.cpp b/native/cocos/renderer/pipeline/custom/LayoutGraphSerialization.cpp index 1b6c117ec1f..8b168992a52 100644 --- a/native/cocos/renderer/pipeline/custom/LayoutGraphSerialization.cpp +++ b/native/cocos/renderer/pipeline/custom/LayoutGraphSerialization.cpp @@ -118,20 +118,6 @@ void load(InputArchive& ar, DescriptorGroupBlockIndex& v) { load(ar, v.format); } -void save(OutputArchive& ar, const DescriptorGroupBlock& v) { - save(ar, v.descriptors); - save(ar, v.uniformBlocks); - save(ar, v.capacity); - save(ar, v.count); -} - -void load(InputArchive& ar, DescriptorGroupBlock& v) { - load(ar, v.descriptors); - load(ar, v.uniformBlocks); - load(ar, v.capacity); - load(ar, v.count); -} - void save(OutputArchive& ar, const DescriptorDB& v) { save(ar, v.blocks); save(ar, v.groupBlocks); diff --git a/native/cocos/renderer/pipeline/custom/LayoutGraphSerialization.h b/native/cocos/renderer/pipeline/custom/LayoutGraphSerialization.h index 6952672efc9..1645d724bb1 100644 --- a/native/cocos/renderer/pipeline/custom/LayoutGraphSerialization.h +++ b/native/cocos/renderer/pipeline/custom/LayoutGraphSerialization.h @@ -50,9 +50,6 @@ void load(InputArchive& ar, DescriptorBlockIndex& v); void save(OutputArchive& ar, const DescriptorGroupBlockIndex& v); void load(InputArchive& ar, DescriptorGroupBlockIndex& v); -void save(OutputArchive& ar, const DescriptorGroupBlock& v); -void load(InputArchive& ar, DescriptorGroupBlock& v); - void save(OutputArchive& ar, const DescriptorDB& v); void load(InputArchive& ar, DescriptorDB& v); diff --git a/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.h b/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.h index a237915f6b4..2071e3c5237 100644 --- a/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.h +++ b/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.h @@ -136,13 +136,6 @@ inline bool operator<(const DescriptorGroupBlockIndex& lhs, const DescriptorGrou std::forward_as_tuple(rhs.updateFrequency, rhs.parameterType, rhs.descriptorType, rhs.visibility, rhs.accessType, rhs.viewDimension, rhs.sampleType, rhs.format); } -struct DescriptorGroupBlock { - ccstd::map descriptors; - ccstd::map uniformBlocks; - uint32_t capacity{0}; - uint32_t count{0}; -}; - struct DescriptorDB { using allocator_type = boost::container::pmr::polymorphic_allocator; allocator_type get_allocator() const noexcept { // NOLINT @@ -159,7 +152,7 @@ struct DescriptorDB { DescriptorDB& operator=(DescriptorDB const& rhs) = default; ccstd::pmr::map blocks; - ccstd::pmr::map groupBlocks; + ccstd::pmr::map groupBlocks; }; struct RenderStageTag {};