From 778045c2968b08b28c6f7b2a33a49996356d9afa Mon Sep 17 00:00:00 2001 From: shg8 Date: Fri, 16 Feb 2024 03:21:36 -0600 Subject: [PATCH 1/2] Fix path checking --- 3dgs/GSScene.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/3dgs/GSScene.h b/3dgs/GSScene.h index b308149..4f43b5b 100644 --- a/3dgs/GSScene.h +++ b/3dgs/GSScene.h @@ -24,9 +24,9 @@ class GSScene { public: explicit GSScene(const std::string& filename) : filename(filename) { - std::filesystem::path file = std::filesystem::current_path() / filename; - if (!std::filesystem::exists(file)) { - throw std::runtime_error("File does not exist"); + // check if file exists + if (!std::filesystem::exists(filename)) { + throw std::runtime_error("File does not exist: " + filename); } } From f92a4ace138a63f7b27ded0b850578208abd1eae Mon Sep 17 00:00:00 2001 From: shg8 Date: Fri, 16 Feb 2024 03:32:10 -0600 Subject: [PATCH 2/2] Decrease reserved memory --- 3dgs/Renderer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/3dgs/Renderer.cpp b/3dgs/Renderer.cpp index 8524309..b9dea8c 100644 --- a/3dgs/Renderer.cpp +++ b/3dgs/Renderer.cpp @@ -13,7 +13,7 @@ #include "../vulkan/Utils.h" -#define SORT_ALLOCATE_MULTIPLIER 100 +#define SORT_ALLOCATE_MULTIPLIER 10 void Renderer::initialize() { initializeVulkan(); @@ -446,6 +446,9 @@ void Renderer::recordRenderCommandBuffer(uint32_t currentFrame) { uint32_t numInstances = totalSumBufferHost->readOne(); // std::cout << "Num instances: " << numInstances << std::endl; + if (numInstances > scene->getNumVertices() * SORT_ALLOCATE_MULTIPLIER) { + throw std::runtime_error("Gaussian instantiation out of memory"); + } assert(numInstances <= scene->getNumVertices() * SORT_ALLOCATE_MULTIPLIER); for (auto i = 0; i < 8; i++) { sortHistPipeline->bind(renderCommandBuffer, 0, i % 2 == 0 ? 0 : 1);