From 89af666310a4f418d8e5baedabc47cf1464bd355 Mon Sep 17 00:00:00 2001
From: Alexander Gauggel <agauggel@uni-koblenz.de>
Date: Fri, 25 Jun 2021 12:18:36 +0200
Subject: [PATCH] [#82] Fix sky artifacts

---
 projects/voxelization/src/main.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/projects/voxelization/src/main.cpp b/projects/voxelization/src/main.cpp
index fcdb4f2b..5fc41cdc 100644
--- a/projects/voxelization/src/main.cpp
+++ b/projects/voxelization/src/main.cpp
@@ -118,7 +118,7 @@ int main(int argc, const char** argv) {
 	
 	const vk::Format depthBufferFormat = vk::Format::eD32Sfloat;
 	const vkcv::AttachmentDescription depth_attachment(
-		vkcv::AttachmentOperation::DONT_CARE,
+		vkcv::AttachmentOperation::STORE,
 		vkcv::AttachmentOperation::LOAD,
 		depthBufferFormat
 	);
@@ -334,8 +334,8 @@ int main(int argc, const char** argv) {
 	skyPipeConfig.m_VertexLayout        = vkcv::VertexLayout();
 	skyPipeConfig.m_DescriptorLayouts   = {};
 	skyPipeConfig.m_UseDynamicViewport  = true;
-    skyPipeConfig.m_multisampling       = msaa;
-    skyPipeConfig.m_depthWrite          = false;
+	skyPipeConfig.m_multisampling       = msaa;
+	skyPipeConfig.m_depthWrite          = false;
 
 	vkcv::PipelineHandle skyPipe = core.createGraphicsPipeline(skyPipeConfig);
 
@@ -576,6 +576,8 @@ int main(int argc, const char** argv) {
 			prepassDrawcalls,
 			prepassRenderTargets);
 
+		core.recordImageMemoryBarrier(cmdStream, depthBuffer);
+
 		// main pass
 		std::vector<std::array<glm::mat4, 2>> mainPassMatrices;
 		for (const auto& m : modelMatrices) {
-- 
GitLab