Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the issue where the screen would be abnormal after switching the light source scene. #16491

Merged
merged 2 commits into from
Nov 9, 2023
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
9 changes: 6 additions & 3 deletions cocos/rendering/custom/scene-culling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ export class LightResource {
}

tryUpdateRenderSceneLocalDescriptorSet (sceneCulling: SceneCulling): void {
if (!this.resized || !sceneCulling.lightBoundsCullings.size) {
if (!sceneCulling.lightBoundsCullings.size) {
return;
}

Expand All @@ -802,8 +802,11 @@ export class LightResource {
}
for (const submodel of model.subModels) {
const set = submodel.descriptorSet;
set.bindBuffer(this.binding, this.firstLightBufferView!);
set.update();
const prev = set.getBuffer(this.binding);
if (this.resized || prev !== this.firstLightBufferView) {
set.bindBuffer(this.binding, this.firstLightBufferView!);
set.update();
}
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions native/cocos/renderer/pipeline/custom/NativeSceneCulling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ void LightResource::buildLightBuffer(gfx::CommandBuffer* cmdBuffer) const {
}

void LightResource::tryUpdateRenderSceneLocalDescriptorSet(const SceneCulling& sceneCulling) {
if (!resized) {
if (sceneCulling.lightBoundsCullingResults.empty()) {
return;
}

Expand All @@ -794,8 +794,11 @@ void LightResource::tryUpdateRenderSceneLocalDescriptorSet(const SceneCulling& s
CC_EXPECTS(model);
for (const auto& submodel : model->getSubModels()) {
auto* set = submodel->getDescriptorSet();
set->bindBuffer(binding, firstLightBufferView);
set->update();
const auto& prev = set->getBuffer(binding);
if (resized || prev != firstLightBufferView) {
set->bindBuffer(binding, firstLightBufferView);
set->update();
}
}
}
}
Expand Down
Loading