I am learning vulkan. I try to set the binding number of input vertices in vertex shader like uniform buffer.
//c++ use vulkan.hpp
vk::VertexInputBindingDescription binding;
binding.setBinding(0)
.setInputRate(vk::VertexInputRate::eVertex)
.setStride(sizeof(Vertex));
//shader
layout(location = 0, binding = 0) in vec3 position;
But I get this error when compile it.
'binding' : requires uniform or buffer storage qualifier
'binding' : requires block, or sampler/image, or atomic-counter type
If I don't set the binding in shader code, It works ok.
Where should I set the input vertices binding number in shader code corresponding to "VkVertexInputBindingDescription.binding" set in c++ code? Further,under what circumstances can VkVertexInputBindingDescription's binding be set to 1 or other number except 0?
Sorry for pool English.
The vertex input binding is not something your shader cares about. That is about the association between a buffer and which vertex attribute locations are fed from that buffer. The vertex shader doesn't care about that mapping; it only cares about vertex attribute locations.
under what circumstances can VkVertexInputBindingDescription's binding be set to 1 or other number except 0?
When you're fetching vertex data from more than one buffer.