Bind gaussian splat chunk metadata in prepare pass

This commit is contained in:
2026-04-11 13:55:39 +08:00
parent ff4e3f639a
commit 88a71a5426
7 changed files with 148 additions and 15 deletions

View File

@@ -244,7 +244,8 @@ bool BuiltinGaussianSplatPass::PrepareGaussianSplatResources(
cachedGaussianSplat->positions.shaderResourceView == nullptr ||
cachedGaussianSplat->other.shaderResourceView == nullptr ||
cachedGaussianSplat->color.shaderResourceView == nullptr ||
cachedGaussianSplat->sh.shaderResourceView == nullptr) {
cachedGaussianSplat->sh.shaderResourceView == nullptr ||
cachedGaussianSplat->chunks.shaderResourceView == nullptr) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinGaussianSplatPass::PrepareGaussianSplatResources failed: gaussian splat GPU cache incomplete");
@@ -579,6 +580,7 @@ BuiltinGaussianSplatPass::PassResourceLayout* BuiltinGaussianSplatPass::GetOrCre
passLayout.gaussianSplatOtherBuffer = bindingPlan.gaussianSplatOtherBuffer;
passLayout.gaussianSplatColorBuffer = bindingPlan.gaussianSplatColorBuffer;
passLayout.gaussianSplatSHBuffer = bindingPlan.gaussianSplatSHBuffer;
passLayout.gaussianSplatChunkBuffer = bindingPlan.gaussianSplatChunkBuffer;
passLayout.gaussianSplatViewDataBuffer = bindingPlan.gaussianSplatViewDataBuffer;
if (!passLayout.perObject.IsValid()) {
@@ -601,9 +603,10 @@ BuiltinGaussianSplatPass::PassResourceLayout* BuiltinGaussianSplatPass::GetOrCre
!passLayout.gaussianSplatOtherBuffer.IsValid() ||
!passLayout.gaussianSplatColorBuffer.IsValid() ||
!passLayout.gaussianSplatSHBuffer.IsValid() ||
!passLayout.gaussianSplatChunkBuffer.IsValid() ||
!passLayout.gaussianSplatViewDataBuffer.IsValid()) {
return failLayout(
"BuiltinGaussianSplatPass prepare-order pass requires sort distance, order, position, other, color, SH, and view-data gaussian splat buffer bindings");
"BuiltinGaussianSplatPass prepare-order pass requires sort distance, order, position, other, color, SH, chunk, and view-data gaussian splat buffer bindings");
}
} else if (usage == PassLayoutUsage::BitonicSort) {
if (!passLayout.gaussianSplatSortDistanceBuffer.IsValid() ||
@@ -936,6 +939,20 @@ BuiltinGaussianSplatPass::CachedDescriptorSet* BuiltinGaussianSplatPass::GetOrCr
}
}
if (setLayout.usesGaussianSplatChunkBuffer) {
if (cachedGaussianSplat.chunks.shaderResourceView == nullptr ||
!passLayout.gaussianSplatChunkBuffer.IsValid() ||
passLayout.gaussianSplatChunkBuffer.set != setIndex) {
return nullptr;
}
if (cachedDescriptorSet.chunkView != cachedGaussianSplat.chunks.shaderResourceView) {
cachedDescriptorSet.descriptorSet.set->Update(
passLayout.gaussianSplatChunkBuffer.binding,
cachedGaussianSplat.chunks.shaderResourceView);
}
}
if (setLayout.usesGaussianSplatViewDataBuffer) {
if (resolvedViewDataView == nullptr ||
!passLayout.gaussianSplatViewDataBuffer.IsValid() ||
@@ -957,6 +974,7 @@ BuiltinGaussianSplatPass::CachedDescriptorSet* BuiltinGaussianSplatPass::GetOrCr
cachedDescriptorSet.otherView = cachedGaussianSplat.other.shaderResourceView;
cachedDescriptorSet.colorView = cachedGaussianSplat.color.shaderResourceView;
cachedDescriptorSet.shView = cachedGaussianSplat.sh.shaderResourceView;
cachedDescriptorSet.chunkView = cachedGaussianSplat.chunks.shaderResourceView;
cachedDescriptorSet.viewDataView = resolvedViewDataView;
return &cachedDescriptorSet;
}
@@ -993,6 +1011,7 @@ void BuiltinGaussianSplatPass::DestroyPassResourceLayout(PassResourceLayout& pas
passLayout.gaussianSplatOtherBuffer = {};
passLayout.gaussianSplatColorBuffer = {};
passLayout.gaussianSplatSHBuffer = {};
passLayout.gaussianSplatChunkBuffer = {};
passLayout.gaussianSplatViewDataBuffer = {};
}
@@ -1018,7 +1037,8 @@ bool BuiltinGaussianSplatPass::PrepareVisibleGaussianSplat(
cachedGaussianSplat->positions.shaderResourceView == nullptr ||
cachedGaussianSplat->other.shaderResourceView == nullptr ||
cachedGaussianSplat->color.shaderResourceView == nullptr ||
cachedGaussianSplat->sh.shaderResourceView == nullptr) {
cachedGaussianSplat->sh.shaderResourceView == nullptr ||
cachedGaussianSplat->chunks.shaderResourceView == nullptr) {
return fail("BuiltinGaussianSplatPass prepare-order failed: gaussian splat GPU cache is incomplete");
}
@@ -1109,6 +1129,7 @@ bool BuiltinGaussianSplatPass::PrepareVisibleGaussianSplat(
setLayout.usesGaussianSplatOtherBuffer ||
setLayout.usesGaussianSplatColorBuffer ||
setLayout.usesGaussianSplatSHBuffer ||
setLayout.usesGaussianSplatChunkBuffer ||
setLayout.usesGaussianSplatViewDataBuffer)) {
return fail("BuiltinGaussianSplatPass prepare-order failed: unexpected descriptor set layout");
}
@@ -1122,6 +1143,7 @@ bool BuiltinGaussianSplatPass::PrepareVisibleGaussianSplat(
setLayout.usesGaussianSplatOtherBuffer ||
setLayout.usesGaussianSplatColorBuffer ||
setLayout.usesGaussianSplatSHBuffer ||
setLayout.usesGaussianSplatChunkBuffer ||
setLayout.usesGaussianSplatViewDataBuffer)
? visibleGaussianSplat.gaussianSplat
: nullptr;