## Vulkan Commands
We have seen that Vulkan stores all graphics related commands into Commands Buffers, that can later be submitted to a queue for execution.
Not all the commands that can be issued are related with rendering. However, the ones that draws something must be called inside a render pass, that must be started with vkCmdBeginRenderPass ( ) .
## Ending a render pass
Once all commands of one pass have been recorded, it must be concluded with vkCmdEndRenderPass () .
## Resources binding
The first step is binding (loading) all resources needed for drawing: pipeline, vertex and index buffer, descriptor sets.
## Resources binding
Bindings remain valid until changed by a new one. For example, to draw several objects using the same shaders (pipeline), only index and vertex buffer, and descriptor sets need to be updated.
## Resources binding
Vertex buffers can be split into several memory area. For this reason they must be passed into an array of vertexBuffers and of fset inside such buffers. This use is however too advanced and outside the scope of this course.
## Resources binding
To improve performance, the same buffer can be used to include several primitives. For this reason, both the index and the vertex buffer binding commands can specify an offset inside them.
## Resources binding
Descriptor Sets (which are the instances of Descriptor Sets Layout) requires both the specification of the pipeline type, and of its layout. Several consecutive Sets can be bound with a single command: for this reason they are passed as an array.
## Primitive Drawing
In this case, of course, binding the Index Buffer is not required. vkCmdDraw (commandBuffers [i] , 3, 1, 0, 0);
The actual vkCmdDraw function is a bit anticlimactic, but it's so simple because of all the information we specified in advance. It has the following parameters, aside from the command buffer:
Indexed primitives are drawn with the `vkCmdDrawIndexed()` command. The command requires the following parameters:
1. Command Buffer handle
2. Number of indices to consider
3. Number of instances to draw
4. Position (in the buffer) of the index from which start drawing
5. Offset added to the indices
6. First instance to be drawn
## Instancing
In many scenes, some objects are repeated several times.
They all share the same geometry and Shaders, but they are characterized by different World Matrices.
In this case, the geometry can be stored only once, and it can be instanced (repeated) several times.
Each instance uses the same mesh, but shows the object in a different place with its own world matrix.
Vulkan natively supports instanced drawing:
- All drawing commands require the number of instances to be drawn.
- Each instance can find inside the built-in global variable gl_InstanceIndex the ID of the copy currently drawn, which can be used to find its specific parameters, such as its transform matrices.
- Moreover, it is possible to define in variables, similar to the one used per vertices, which depends on the instance. A complete description of the subject is however outside the scopes of the course.