Stabilize 3DGS D3D12 phase 3 and sort key setup

This commit is contained in:
2026-04-13 02:23:39 +08:00
parent 1d6f2e290d
commit b7428b0ef1
10 changed files with 1281 additions and 33 deletions

View File

@@ -20,8 +20,24 @@
#include "XCEngine/RHI/D3D12/D3D12SwapChain.h"
#include "XCEngine/RHI/D3D12/D3D12Texture.h"
namespace XCEngine {
namespace RHI {
class RHIDescriptorPool;
class RHIDescriptorSet;
class RHIPipelineLayout;
class RHIPipelineState;
} // namespace RHI
} // namespace XCEngine
namespace XC3DGSD3D12 {
struct PreparedSplatView {
float clipPosition[4] = {};
float axis1[2] = {};
float axis2[2] = {};
uint32_t packedColor[2] = {};
};
class App {
public:
App();
@@ -32,6 +48,7 @@ public:
void SetFrameLimit(unsigned int frameLimit);
void SetGaussianScenePath(std::wstring scenePath);
void SetSummaryPath(std::wstring summaryPath);
void SetScreenshotPath(std::wstring screenshotPath);
const std::wstring& GetLastErrorMessage() const;
private:
@@ -47,9 +64,16 @@ private:
bool LoadGaussianScene();
bool InitializeRhi();
bool InitializeGaussianGpuResources();
bool InitializePreparePassResources();
bool InitializeSortResources();
bool InitializeDebugDrawResources();
void ShutdownGaussianGpuResources();
void ShutdownPreparePassResources();
void ShutdownSortResources();
void ShutdownDebugDrawResources();
void Shutdown();
void RenderFrame();
bool CaptureSortKeySnapshot();
void RenderFrame(bool captureScreenshot);
HWND m_hwnd = nullptr;
HINSTANCE m_instance = nullptr;
@@ -62,6 +86,8 @@ private:
unsigned int m_renderedFrameCount = 0;
std::wstring m_gaussianScenePath = L"room.ply";
std::wstring m_summaryPath;
std::wstring m_screenshotPath = L"phase3_debug_points.ppm";
std::wstring m_sortKeySnapshotPath = L"phase3_sortkeys.txt";
std::wstring m_lastErrorMessage;
GaussianSplatRuntimeData m_gaussianSceneData;
XCEngine::RHI::D3D12Buffer m_gaussianPositionBuffer;
@@ -73,6 +99,26 @@ private:
std::unique_ptr<XCEngine::RHI::D3D12ResourceView> m_gaussianShView;
std::unique_ptr<XCEngine::RHI::D3D12ResourceView> m_gaussianColorView;
std::vector<Microsoft::WRL::ComPtr<ID3D12Resource>> m_gaussianUploadBuffers;
XCEngine::RHI::D3D12Buffer* m_preparedViewBuffer = nullptr;
std::unique_ptr<XCEngine::RHI::D3D12ResourceView> m_preparedViewSrv;
std::unique_ptr<XCEngine::RHI::D3D12ResourceView> m_preparedViewUav;
XCEngine::RHI::RHIPipelineLayout* m_preparePipelineLayout = nullptr;
XCEngine::RHI::RHIPipelineState* m_preparePipelineState = nullptr;
XCEngine::RHI::RHIDescriptorPool* m_prepareDescriptorPool = nullptr;
XCEngine::RHI::RHIDescriptorSet* m_prepareDescriptorSet = nullptr;
XCEngine::RHI::D3D12Buffer* m_sortKeyBuffer = nullptr;
XCEngine::RHI::D3D12Buffer* m_orderBuffer = nullptr;
std::unique_ptr<XCEngine::RHI::D3D12ResourceView> m_sortKeySrv;
std::unique_ptr<XCEngine::RHI::D3D12ResourceView> m_sortKeyUav;
std::unique_ptr<XCEngine::RHI::D3D12ResourceView> m_orderBufferSrv;
XCEngine::RHI::RHIPipelineLayout* m_sortPipelineLayout = nullptr;
XCEngine::RHI::RHIPipelineState* m_sortPipelineState = nullptr;
XCEngine::RHI::RHIDescriptorPool* m_sortDescriptorPool = nullptr;
XCEngine::RHI::RHIDescriptorSet* m_sortDescriptorSet = nullptr;
XCEngine::RHI::RHIPipelineLayout* m_debugPipelineLayout = nullptr;
XCEngine::RHI::RHIPipelineState* m_debugPipelineState = nullptr;
XCEngine::RHI::RHIDescriptorPool* m_debugDescriptorPool = nullptr;
XCEngine::RHI::RHIDescriptorSet* m_debugDescriptorSet = nullptr;
XCEngine::RHI::D3D12Device m_device;
XCEngine::RHI::D3D12CommandQueue m_commandQueue;