From df9f6d51f4bb583e4df73e7d3c1c4f16fe8132a1 Mon Sep 17 00:00:00 2001
From: Alexander Gauggel <agauggel@uni-koblenz.de>
Date: Mon, 16 Aug 2021 22:44:49 +0200
Subject: [PATCH] [#106] Moved max motion tile size to AppConfig

---
 projects/indirect_dispatch/src/App.cpp       | 4 ++--
 projects/indirect_dispatch/src/AppConfig.hpp | 1 +
 projects/indirect_dispatch/src/AppSetup.cpp  | 5 ++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/projects/indirect_dispatch/src/App.cpp b/projects/indirect_dispatch/src/App.cpp
index 0856173a..bd65d314 100644
--- a/projects/indirect_dispatch/src/App.cpp
+++ b/projects/indirect_dispatch/src/App.cpp
@@ -201,8 +201,8 @@ void App::run() {
 		m_core.prepareImageForStorage(cmdStream, m_renderTargets.motionMax);
 
 		const uint32_t motionTileDispatchCounts[3] = {
-			(m_core.getImageWidth( m_renderTargets.motionMax) + 7) / 8,
-			(m_core.getImageHeight(m_renderTargets.motionMax) + 7) / 8,
+			(m_core.getImageWidth( m_renderTargets.motionMax) + AppConfig::maxMotionTileSize - 1) / AppConfig::maxMotionTileSize,
+			(m_core.getImageHeight(m_renderTargets.motionMax) + AppConfig::maxMotionTileSize - 1) / AppConfig::maxMotionTileSize,
 			1 };
 
 		m_core.recordComputeDispatchToCmdStream(
diff --git a/projects/indirect_dispatch/src/AppConfig.hpp b/projects/indirect_dispatch/src/AppConfig.hpp
index c89c34ea..877a1dd3 100644
--- a/projects/indirect_dispatch/src/AppConfig.hpp
+++ b/projects/indirect_dispatch/src/AppConfig.hpp
@@ -7,4 +7,5 @@ namespace AppConfig{
 	const vk::Format    depthBufferFormat   = vk::Format::eD32Sfloat;
 	const vk::Format    colorBufferFormat   = vk::Format::eB10G11R11UfloatPack32;
 	const vk::Format    motionBufferFormat  = vk::Format::eR16G16Sfloat;
+    const uint32_t      maxMotionTileSize   = 8;
 }
\ No newline at end of file
diff --git a/projects/indirect_dispatch/src/AppSetup.cpp b/projects/indirect_dispatch/src/AppSetup.cpp
index 96b182fd..0733aee4 100644
--- a/projects/indirect_dispatch/src/AppSetup.cpp
+++ b/projects/indirect_dispatch/src/AppSetup.cpp
@@ -269,10 +269,9 @@ RenderTargets createRenderTargets(vkcv::Core& core, const uint32_t width, const
 		false,
 		true).getHandle();
 
-	const uint32_t motionTileSize  = 8;
 	// divide and ceil to int
-	const uint32_t motionMaxWidth  = (width  + (motionTileSize - 1)) / motionTileSize;
-	const uint32_t motionMaxheight = (height + (motionTileSize - 1)) / motionTileSize;
+	const uint32_t motionMaxWidth  = (width  + (AppConfig::maxMotionTileSize - 1)) / AppConfig::maxMotionTileSize;
+	const uint32_t motionMaxheight = (height + (AppConfig::maxMotionTileSize - 1)) / AppConfig::maxMotionTileSize;
 
 	targets.motionMax = core.createImage(
 		AppConfig::motionBufferFormat,
-- 
GitLab