From 926e9a6b75b000114e5dddba350d7efe2fd39f0a Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Wed, 11 Mar 2026 19:14:14 +0800 Subject: [PATCH] Fix NanoVDB upload buffer early release causing white screen --- NanoVDBLoader.cpp | 4 ++++ main.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NanoVDBLoader.cpp b/NanoVDBLoader.cpp index 2b1f8d79..dc1345be 100644 --- a/NanoVDBLoader.cpp +++ b/NanoVDBLoader.cpp @@ -92,7 +92,11 @@ bool LoadNanoVDB(const char* filePath, NanoVDBData& outData, ID3D12GraphicsComma barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_GENERIC_READ; cmdList->ResourceBarrier(1, &barrier); + EndCommandList(); + WaitForCompletionOfCommandList(); uploadBuffer->Release(); + GetCommandAllocator()->Reset(); + cmdList->Reset(GetCommandAllocator(), nullptr); } std::cout << "[NanoVDB] Loaded: " << byteSize << " bytes, " << elementCount << " elements" << std::endl; diff --git a/main.cpp b/main.cpp index 8a60ba04..cca83c17 100644 --- a/main.cpp +++ b/main.cpp @@ -104,7 +104,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi StaticMeshComponent staticMeshComponent; staticMeshComponent.InitFromFile(commandList, "Res/Model/Sphere.lhsm"); - bool runTest = false; // set to true to run NanoVDB test + bool runTest = true; // set to true to run NanoVDB test if (runTest) { RunNanoVDBTest(); }