Skip to content
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
3 changes: 3 additions & 0 deletions cocos/core/pipeline/custom/effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ function buildLayoutGraphDataImpl (graph: LayoutGraph, lgData: LayoutGraphBuilde
if (block.capacity > 0) {
lgData.addDescriptorBlock(vid, index, flattened);
}
for (let i = 0; i < flattened.uniformBlockNames.length; ++i) {
lgData.addUniformBlock(vid, index, flattened.uniformBlockNames[i], flattened.uniformBlocks[i]);
}
});
}

Expand Down
15 changes: 14 additions & 1 deletion cocos/core/pipeline/custom/web-layout-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,20 @@ export class WebLayoutGraphBuilder extends LayoutGraphBuilder {
}

public addUniformBlock (nodeID: number, index: DescriptorBlockIndex, name: string, uniformBlock: UniformBlock): void {
// need implementation
const g: LayoutGraphData = this._data;
const ppl: PipelineLayoutData = g.getLayout(nodeID);
const layout: DescriptorSetLayoutData | undefined = ppl.descriptorSets.get(index.updateFrequency)?.descriptorSetLayoutData;
if (layout !== undefined) {
let nameID: number | undefined = g.attributeIndex.get(name);
if (nameID === undefined) {
const id = g.valueNames.length;
g.attributeIndex.set(name, id);
g.valueNames.push(name);
}

nameID = g.attributeIndex.get(name);
layout.uniformBlocks.set(nameID as number, uniformBlock);
}
}

public reserveDescriptorBlock (nodeID: number, index: DescriptorBlockIndex, block: DescriptorBlockFlattened): void {
Expand Down
17 changes: 16 additions & 1 deletion native/cocos/renderer/pipeline/custom/NativeLayoutGraphImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,22 @@ void NativeLayoutGraphBuilder::addDescriptorBlock(
}

void NativeLayoutGraphBuilder::addUniformBlock(uint32_t nodeID, const DescriptorBlockIndex& index, const ccstd::string& name, const gfx::UniformBlock& uniformBlock) {

auto &g = *data;
auto &ppl = get(LayoutGraphData::Layout, g, nodeID);
auto &layout = ppl.descriptorSets[index.updateFrequency].descriptorSetLayoutData;
auto iter = g.attributeIndex.find(boost::string_view(name));
if (iter == g.attributeIndex.end()) {
auto attrID = gsl::narrow_cast<uint32_t>(g.valueNames.size());
g.valueNames.emplace_back(name);
bool added = false;
std::tie(iter, added) = g.attributeIndex.emplace(
std::piecewise_construct,
std::forward_as_tuple(name),
std::forward_as_tuple(NameLocalID{attrID}));
CC_ENSURES(added);
}
const auto &nameID = iter->second;
layout.uniformBlocks.emplace(nameID, uniformBlock);
}

namespace {
Expand Down