Skip to content

Commit

Permalink
cluster lighting logic & pass set update (#16197)
Browse files Browse the repository at this point in the history
  • Loading branch information
hana-alice authored Sep 8, 2023
1 parent 91ce03d commit df2ce56
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 70 deletions.
19 changes: 14 additions & 5 deletions cocos/render-scene/core/pass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
MacroRecord, MaterialProperty, customizeType, getBindingFromHandle, getDefaultFromType, getStringFromType,
getOffsetFromHandle, getTypeFromHandle, type2reader, type2writer, getCountFromHandle, type2validator,
} from './pass-utils';
import { RenderPassStage, RenderPriority } from '../../rendering/define';
import { RenderPassStage, RenderPriority, SetIndex } from '../../rendering/define';
import { InstancedBuffer } from '../../rendering/instanced-buffer';
import { ProgramLibrary } from '../../rendering/custom/private';

Expand Down Expand Up @@ -469,10 +469,19 @@ export class Pass {
* @zh 重置所有 texture 和 sampler 为初始默认值。
*/
public resetTextures (): void {
for (let i = 0; i < this._shaderInfo.samplerTextures.length; i++) {
const u = this._shaderInfo.samplerTextures[i];
for (let j = 0; j < u.count; j++) {
this.resetTexture(u.name, j);
if (cclegacy.rendering) {
const set = this._shaderInfo.descriptors[SetIndex.MATERIAL];
for (const combined of set.samplerTextures) {
for (let j = 0; j < combined.count; ++j) {
this.resetTexture(combined.name, j);
}
}
} else {
for (let i = 0; i < this._shaderInfo.samplerTextures.length; i++) {
const u = this._shaderInfo.samplerTextures[i];
for (let j = 0; j < u.count; j++) {
this.resetTexture(u.name, j);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cocos/rendering/custom/builtin-pipelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class DeferredPipelineBuilder implements PipelineBuilder {
// Lighting Pass
const lightInfo = setupLightingPass(ppl, info, useCluster);
// Deferred ForwardPass, for non-surface-shader material and transparent material
setupDeferredForward(ppl, info, lightInfo.rtName);
setupDeferredForward(ppl, info, lightInfo.rtName, useCluster);
// Postprocess
setupPostprocessPass(ppl, info, lightInfo.rtName);

Expand Down
Loading

0 comments on commit df2ce56

Please sign in to comment.