-2

I'm building a game engine which for now is made to render a basic triangle on the screen. It uses a color attachment, depth attachment and the swap chain image view when creating the frame buffer and the render pass is created supporting for those attachments. Vulkan does not show any validation error messages while creating any of its objects but it does not render anything except for the clear screen color. When I used RenderDoc to debug this issue, it does not show the vertex buffer or the index buffer content. It has the columns and rows right but the values are always set to 0.

Is there any reason for this behavior and what could be the reason for not rendering the basic triangle on the screen? The full repository is at: https://github.com/DhirajWishal/DynamikEngine/tree/renderer-build

Snapshot of the RenderDoc window

Thank You!

D-RAJ
  • 3,263
  • 2
  • 6
  • 24
  • 1
    I don't know Vulkan, but I'd suspect that your code is, for some reason, not putting the data into the vertex or index buffers. – user253751 Jun 29 '20 at 14:59
  • @user253751 i checked the memory of the mapped pointer using visual studio's debugger and it successfully copied all of the data to the vertex and index buffer. – D-RAJ Jun 29 '20 at 15:29
  • Do you need some kind of synchronization thingy to say when you've finished copying the data? – user253751 Jun 29 '20 at 15:31
  • @user253751 Nope. In Vulkan you just map the allocated buffer memory (VkMapMemory(VkDevice, VkDeviceMemory, offset, size, flags, &pointer)) to a local memory address and that address is passed to a pointer. Then we can copy or move our data to that pointer and we just need to call VkUnmapMemory(VkDevice, VkDeviceMemory) to unmap the memory. – D-RAJ Jun 29 '20 at 15:37
  • That's not 100% sure. If you're not using a coherent memory type, unmapping is not enough to make writes visible and you have to manually flush. If RenderDoc does not see your buffers it's most probably an application side error like this one. If you use staging to move from host to device, make sure to flush the copy queue. – Sascha Willems Jun 29 '20 at 18:02
  • @SaschaWillems I use (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) when creating the vertex and index buffers. – D-RAJ Jun 29 '20 at 20:09

1 Answers1

0

I found what the error was. I completely forgot that the maximum and minimum bounds are 1.0f and -1.0f. I unintentionally make the z index -1 which renders it on the boundary. Changing it to 0.0f fixed the issue.

Thanks everyone!

D-RAJ
  • 3,263
  • 2
  • 6
  • 24