From 463a4ac77a4003c46c1ffba6e685757dc4f56a21 Mon Sep 17 00:00:00 2001
From: Vanessa Karolek <vaka1997@uni-koblenz.de>
Date: Fri, 3 Sep 2021 15:41:53 +0200
Subject: [PATCH] [#92] delete lines which throw the bit error

Error:
VUID-vkBindBufferMemory-bufferDeviceAddress-03339(ERROR / SPEC): msgNum: 1151829889 - Validation Error: [ VUID-vkBindBufferMemory-bufferDeviceAddress-03339 ] Object 0: handle = 0x2a4d4b0000000c8a, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x44a78781 | vkBindBufferMemory(): If buffer was created with the VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT bit set, memory must have been allocated with the VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT bit set. The Vulkan spec states: If the VkPhysicalDeviceBufferDeviceAddressFeatures::bufferDeviceAddress feature is enabled and buffer was created with the VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT bit set, memory must have been allocated with the VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT bit set (https://vulkan.lunarg.com/doc/view/1.2.170.0/windows/1.2-extensions/vkspec.html#VUID-vkBindBufferMemory-bufferDeviceAddress-03339)
    Objects: 1
        [0] 0x2a4d4b0000000c8a, type: 9, name: NULL

Process finished with exit code 0

TODO:
We still need to resolve line 78 in ASManager.cpp! This also throws this error.
---
 projects/rtx/src/main.cpp | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/projects/rtx/src/main.cpp b/projects/rtx/src/main.cpp
index 4e37db64..d5bda3a5 100644
--- a/projects/rtx/src/main.cpp
+++ b/projects/rtx/src/main.cpp
@@ -67,28 +67,15 @@ int main(int argc, const char** argv) {
 
 	assert(!mesh.vertexGroups.empty());
 
-	auto vertexBuffer = core.createBuffer<uint8_t>(
-	        vkcv::BufferType::RT_ACCELERATION_VERTEX,
-	        mesh.vertexGroups[0].vertexBuffer.data.size(),
-	        vkcv::BufferMemoryType::DEVICE_LOCAL
-	        );
 	std::vector<uint8_t> vertices = {};
 	for (size_t i=0; i<mesh.vertexGroups[0].vertexBuffer.data.size(); i++) {
-	    vertices.emplace_back(mesh.vertexGroups[0].vertexBuffer.data[i]);
+	    vertices.push_back(mesh.vertexGroups[0].vertexBuffer.data[i]);
 	}
-	vertexBuffer.fill(vertices);
 
-	auto indexBuffer = core.createBuffer<uint8_t>(
-	        vkcv::BufferType::RT_ACCELERATION_INDEX,
-	        mesh.vertexGroups[0].indexBuffer.data.size(),
-	        vkcv::BufferMemoryType::DEVICE_LOCAL
-    );
 	std::vector<uint8_t> indices = {};
 	for (size_t i=0; i<mesh.vertexGroups[0].indexBuffer.data.size(); i++) {
-	    indices.emplace_back(mesh.vertexGroups[0].indexBuffer.data[i]);
+	    indices.push_back(mesh.vertexGroups[0].indexBuffer.data[i]);
 	}
-	indexBuffer.fill(indices);
-
 
 	// init RTXModule
     rtxModule.init(&core, vertices, indices);
-- 
GitLab