From faf68405c49ba3401901745042c664ed056df39b Mon Sep 17 00:00:00 2001
From: Alexander Gauggel <agauggel@uni-koblenz.de>
Date: Mon, 16 Aug 2021 22:51:26 +0200
Subject: [PATCH] [#106] Removed incorrect usage of max motion tile size in
 dispatch size computation and increased tile size from 8 to 20

---
 .../indirect_dispatch/resources/shaders/motionVectorMax.comp  | 2 +-
 projects/indirect_dispatch/src/App.cpp                        | 4 ++--
 projects/indirect_dispatch/src/AppConfig.hpp                  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/projects/indirect_dispatch/resources/shaders/motionVectorMax.comp b/projects/indirect_dispatch/resources/shaders/motionVectorMax.comp
index f5a9fa3b..725fc3f4 100644
--- a/projects/indirect_dispatch/resources/shaders/motionVectorMax.comp
+++ b/projects/indirect_dispatch/resources/shaders/motionVectorMax.comp
@@ -7,7 +7,7 @@ layout(set=0, binding=2, rgba8) uniform image2D     outMotionMax;
 
 layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
 
-const int motionTileSize = 8;
+const int motionTileSize = 20;
 
 void main(){
     
diff --git a/projects/indirect_dispatch/src/App.cpp b/projects/indirect_dispatch/src/App.cpp
index bd65d314..0856173a 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) + AppConfig::maxMotionTileSize - 1) / AppConfig::maxMotionTileSize,
-			(m_core.getImageHeight(m_renderTargets.motionMax) + AppConfig::maxMotionTileSize - 1) / AppConfig::maxMotionTileSize,
+			(m_core.getImageWidth( m_renderTargets.motionMax) + 7) / 8,
+			(m_core.getImageHeight(m_renderTargets.motionMax) + 7) / 8,
 			1 };
 
 		m_core.recordComputeDispatchToCmdStream(
diff --git a/projects/indirect_dispatch/src/AppConfig.hpp b/projects/indirect_dispatch/src/AppConfig.hpp
index 877a1dd3..370b9684 100644
--- a/projects/indirect_dispatch/src/AppConfig.hpp
+++ b/projects/indirect_dispatch/src/AppConfig.hpp
@@ -7,5 +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;
+    const uint32_t      maxMotionTileSize   = 20;	// must match "motionTileSize" in motionVectorMax.comp
 }
\ No newline at end of file
-- 
GitLab