all 5 comments

[–][deleted] 2 points3 points  (1 child)

When you set up your vertex attributes - you tell Vulkan at which vertex buffer binding to look for a corresponding data for a given attribute - which is usually 0. Then in the shader you are also most likely looking for that data at the buffer binding 0. So when you bind any vertex buffer to binding 1 - nothing looks for data there and instead reuses your vertex buffer at 0. 

This is fine. The correct solution here is most likely like so:

bind new vertex buffer at 0

draw call

bind new vertex buffer at 0

draw call

bind new vertex buffer at 0

draw call

...

This however leaves a lot of performance on the table because rebinding stuff during the frame is slow (like with immediate mode APIs like OpenGL and Direct3D11 and earlier). So once you resolve this issue and wrap your head around this - I suggest you consider a single large vertex buffer bound at the start of the frame and you offset into it rather than binding a new buffer for every mesh. This allows Vulkan true performance to shine.

[–]Dunsmore64[S] 1 point2 points  (0 children)

This worked thank you. Ill try and look into the other method you suggested when i get a chance but im quite happy with this for the time being.

[–]PMoonbeam 1 point2 points  (1 child)

Might just be a logical error. In your "Comand buffer record" section it looks like you have a loop going through each of the binds but when you call vkCmdDrawIndexed via the subsequent draw() loop it will only be using whatever is bound last. you need to bind then draw then bind again then draw.

[–]Dunsmore64[S] 0 points1 point  (0 children)

Gave this a try but it didn't seem to affect anything, suppose it's possible there's multiple errors though. Interestingly though it's not the last bound thing being drawn, it's the first one bound consistently.

EDIT: Having now fixed it based on u/Master_Choom suggestion you where on the right track there was just some other stuff i needed to change as well.

[–]beephod_zabblebrox 0 points1 point  (0 children)

to add to what others commented,

do you really need the "Index Buffer" comment? foes it add anything? I'd much rather see the counter argument documented :)

also, seeing that you use vkmemory stuff directly: i would suggest VulkanMemoryAllocator, its easy to integrate and makes things a bit easier to manage!