An OpenGL context represents:
- An interface for issuing a single sequence of rendering commands for a particular piece of hardware.
- The current set of state that will be used for any rendering operations on that hardware.
- A set of objects which are usable by rendering operations, as well as the ability to interact with them. Some of these objects may be shared with other contexts.
Vulkan doesn't have a single thing that represents all of these. There is no "Vulkan context". And indeed, a Vulkan instance doesn't represent any of the above.
See, while an OpenGL context defines an interface for a particular piece of hardware, it doesn't define how to create that context. External APIs exist for creating a context. And these external APIs are entirely platform-dependent.
Vulkan wants to both define the hardware interface and provide a framework for creating one. That framework will be platform-dependent to some degree, but only to the degree that is absolutely necessary.
Specifically, the only platform-dependent part of dealing with Vulkan is interacting with an OS-provided display system (ie: a window). Everything else is platform-neutral.
A Vulkan instance is the interface for interacting with the available hardware. You use a Vulkan interface to ask what Vulkan-capable hardware is available, what their capabilities and limitations are, and how to create a Vulkan device from that hardware (and to optionally attach it to an OS-provided display system).
Individual Vulkan implementations on your machine register themselves with the Vulkan instance system. This allows the instance implementation to talk to them and ask them those questions.
The closest thing Vulkan has to an OpenGL context is a Vulkan logical device (VkDevice
). These are built from one or more "physical devices" (representing actual GPUs), and they provide the interface for interacting with the rendering system. But even that doesn't really do most of the OpenGL context stuff. It only really does #3.
Command buffers represent the current state for rendering commands, as well as the rendering commands themselves. But you can have many separate command buffers, and they are not executed immediately.
Executing command buffers is done through queues, which come from devices. A queue is a separate path of execution for command buffers.
Vulkan is not like OpenGL. You shouldn't try to map Vulkan constructs onto OpenGL constructs (except when they literally have the same name, like "texture" or "shader" or whatever). Take Vulkan for what it is, not for how it looks like OpenGL.