From e2378322a9a664909a0e3afdb09a8792f4b73e09 Mon Sep 17 00:00:00 2001
From: Jens Koenen <koenen@vr.rwth-aachen.de>
Date: Wed, 28 Jun 2023 17:35:22 +0200
Subject: [PATCH] Dynamic cell subdivision resolution implemented

---
 src/strategy/dual_layer_reprojection.cpp | 5 ++++-
 src/strategy/dual_layer_reprojection.hpp | 7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/strategy/dual_layer_reprojection.cpp b/src/strategy/dual_layer_reprojection.cpp
index c47e9934..44a0da98 100644
--- a/src/strategy/dual_layer_reprojection.cpp
+++ b/src/strategy/dual_layer_reprojection.cpp
@@ -7,7 +7,6 @@ namespace glsl
 using namespace glm;
 using uint = glm::uint32;
 #include "res/dpr/strategy/dual_layer_reprojection/dual_layer_reprojection_data.inc"
-#include "res/dpr/strategy/dual_layer_reprojection/dual_layer_reprojection_defines.inc"
 }
 
 DualLayerReprojection::DualLayerReprojection()
@@ -204,7 +203,10 @@ bool DualLayerReprojection::on_interface()
     ImGui::SliderFloat("Reproject Slope Threshold", &this->reproject_slope_threshold, 0.0f, 1.0f);
     ImGui::SliderFloat("Subdivision Threshold", &this->subdivision_threshold, 0.0, 1.0f);
     ImGui::SliderInt("Subdivide Cell Border", (int32_t*)&this->subdivide_cell_border, 0, 8);
+    ImGui::SliderInt("Subdivide Resolution", (int32_t*) &this->subdivision_resolution, 2, DUAL_LAYER_REPROJECTION_SUBDIVIDE_GROUP_SIZE);
+
     ImGui::SliderFloat("Debug Value", &this->debug_value, 0.0, 1.0f);
+
     ImGui::Checkbox("Wireframe", &this->wireframe);
     ImGui::Checkbox("Performance View", &this->performance_view);
 
@@ -274,6 +276,7 @@ bool DualLayerReprojection::on_render(VkCommandBuffer command_buffer, lava::inde
     metadata.debug_value = this->debug_value;
     metadata.wireframe = this->wireframe;
     metadata.performance_view = this->performance_view;
+    metadata.subdivision_resolution = this->subdivision_resolution;
 
     this->get_headset()->submit_metadata(std::span<uint8_t>((uint8_t*)&metadata, sizeof(metadata)));
 
diff --git a/src/strategy/dual_layer_reprojection.hpp b/src/strategy/dual_layer_reprojection.hpp
index 9481679c..07c221e0 100644
--- a/src/strategy/dual_layer_reprojection.hpp
+++ b/src/strategy/dual_layer_reprojection.hpp
@@ -3,6 +3,11 @@
 
 #include "stereo_strategy.hpp"
 
+namespace glsl
+{
+#include "res/dpr/strategy/dual_layer_reprojection/dual_layer_reprojection_defines.inc"
+}
+
 enum DualLayerReprojectionOverlay : uint32_t
 {
     DUAL_LAYER_REPROJECTION_OVERLAY_COLOR,
@@ -39,6 +44,7 @@ struct DualLayerReprojectionMetadata
     float debug_value;
     bool wireframe;
     bool performance_view;
+    uint32_t subdivision_resolution;
 };
 
 class DualLayerReprojection : public StereoStrategy
@@ -91,6 +97,7 @@ private:
     float debug_value = 0.0f;
     bool wireframe = false;
     bool performance_view = false;
+    uint32_t subdivision_resolution = DUAL_LAYER_REPROJECTION_SUBDIVIDE_GROUP_SIZE;
 
     glm::uvec2 layer_resolution = glm::uvec2(0);
     glm::mat4 layer_projection_matrix = glm::mat4(1.0f);
-- 
GitLab