Skip to content

Commit

Permalink
engine add WebGPU support (#18196)
Browse files Browse the repository at this point in the history
  • Loading branch information
star-e authored Jan 16, 2025
1 parent ae9a255 commit 037cbe8
Show file tree
Hide file tree
Showing 7 changed files with 302 additions and 82 deletions.
9 changes: 5 additions & 4 deletions cocos/rendering/custom/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ export function getDescBindingFromName (bindingName: string): number {
let currDesData: DescriptorSetData;
for (const i of vertIds) {
const layout = layoutGraph.getLayout(i);
for (const [k, descData] of layout.descriptorSets) {
const sets = layout.getSets();
for (const [k, descData] of sets) {
const layoutData = descData.descriptorSetLayoutData;
const blocks = layoutData.descriptorBlocks;
for (const b of blocks) {
Expand Down Expand Up @@ -493,15 +494,15 @@ export function getDescriptorSetDataFromLayout (layoutName: string): DescriptorS
const webPip = cclegacy.director.root.pipeline as WebPipeline;
const stageId = webPip.layoutGraph.locateChild(webPip.layoutGraph.N, layoutName);
const layout = webPip.layoutGraph.getLayout(stageId);
const layoutData = layout.descriptorSets.get(UpdateFrequency.PER_PASS);
const layoutData = layout.getSet(UpdateFrequency.PER_PASS);
layouts.set(layoutName, layoutData!);
return layoutData;
}

export function getDescriptorSetDataFromLayoutId (id: number): DescriptorSetData | undefined {
const webPip = cclegacy.director.root.pipeline as WebPipeline;
const layout = webPip.layoutGraph.getLayout(id);
const layoutData = layout.descriptorSets.get(UpdateFrequency.PER_PASS);
const layoutData = layout.getSet(UpdateFrequency.PER_PASS);
return layoutData;
}

Expand All @@ -514,7 +515,7 @@ function getUniformBlock (block: string, layoutName: string): UniformBlock | und
const lg = webPip.layoutGraph;
const nodeId = lg.locateChild(0xFFFFFFFF, layoutName);
const ppl = lg.getLayout(nodeId);
const layout = ppl.descriptorSets.get(UpdateFrequency.PER_PASS)!.descriptorSetLayoutData;
const layout = ppl.getSet(UpdateFrequency.PER_PASS)!.descriptorSetLayoutData;
const nameID: number = lg.attributeIndex.get(block)!;
return layout.uniformBlocks.get(nameID);
}
Expand Down
Loading

0 comments on commit 037cbe8

Please sign in to comment.