From 75648a60ed835c1b733c394b89251702e1fdb1e0 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Mon, 30 Sep 2019 17:36:58 +0300
Subject: [PATCH] Remove upsample from attrib accum

---
 components/renderers/cpp/src/splatter.cu | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/components/renderers/cpp/src/splatter.cu b/components/renderers/cpp/src/splatter.cu
index 6b615fa6b..c7456e57b 100644
--- a/components/renderers/cpp/src/splatter.cu
+++ b/components/renderers/cpp/src/splatter.cu
@@ -63,6 +63,8 @@ __device__ inline float4 make_float4(const uchar4 &c) {
 #define SMOOTHING_MULTIPLIER_B 4.0f		// For z contribution
 #define SMOOTHING_MULTIPLIER_C 4.0f		// For colour contribution
 
+#define ACCUM_DIAMETER 8
+
 /*
  * Pass 2: Accumulate attribute contributions if the points pass a visibility test.
  */
@@ -92,7 +94,7 @@ __global__ void dibr_attribute_contrib_kernel(
 	if (camPos.z > params.camera.maxDepth) return;
 	const uint2 screenPos = params.camera.camToScreen<uint2>(camPos);
 
-    const int upsample = 8; //min(UPSAMPLE_MAX, int((5.0f*r) * params.camera.fx / camPos.z));
+    //const int upsample = 8; //min(UPSAMPLE_MAX, int((5.0f*r) * params.camera.fx / camPos.z));
 
 	// Not on screen so stop now...
 	if (screenPos.x >= depth_in.width() || screenPos.y >= depth_in.height()) return;
@@ -107,9 +109,9 @@ __global__ void dibr_attribute_contrib_kernel(
 
 	// Each thread in warp takes an upsample point and updates corresponding depth buffer.
 	const int lane = tid % WARP_SIZE;
-	for (int i=lane; i<upsample*upsample; i+=WARP_SIZE) {
-		const float u = (i % upsample) - (upsample / 2);
-		const float v = (i / upsample) - (upsample / 2);
+	for (int i=lane; i<ACCUM_DIAMETER*ACCUM_DIAMETER; i+=WARP_SIZE) {
+		const float u = (i % ACCUM_DIAMETER) - (ACCUM_DIAMETER / 2);
+		const float v = (i / ACCUM_DIAMETER) - (ACCUM_DIAMETER / 2);
 
         // Use the depth buffer to determine this pixels 3D position in camera space
         const float d = ((float)depth_in.tex2D(screenPos.x+u, screenPos.y+v)/1000.0f);
-- 
GitLab