gst-launch-1.0 videotestsrc ! vulkanupload ! vulkansink
Disclaimer: this is still alpha-quality code and it hasn't had the same extensive testing as the OpenGL elements and there are a number of short fallings:
- It doesn't scale the input video to the output surface size (yet).
- There's very little locking (as required by the Vulkan specification, e.g. VkCommandBuffer's and VkCommandPool's).
- There aren't any effects/colour conversion implemented.
- Performance has not been a primary concern so there are some inefficiencies in the current design.
The hard API change also provides a higher baseline for implementations and applications to depend against which resets the amount of legacy code that would need to be maintained for older GPU's and systems.
Implementation DetailsThe current implementation of libgstgl was used extensively as a basis for the structure of how Vulkan is intended to be used in GStreamer.
MemoryVulkan provides a high level overview of accessing GPU memory through VkDeviceMemory objects. These are simply wrapped in GstMemory objects as GstVulkanMemory with allocation and destruction routines for creating and destroying GPU memory as well as mapping with gst_memory_map() for CPU access to the data (if supported at creation).
Vulkan provides VkBuffer objects which are somewhat equivalent to OpenGL's Buffer objects which are used for storing vertices, draw indices, uniforms, texels, etc and is wrapped up in GStreamer into the GstVulkanBufferMemory object (a subclass of GstMemory). As a backing store, it allocates a GstVulkanMemory object.
GstVulkanImageMemory provides the same abstraction for VkImage objects which also have a backing store of a GstVulkanMemory.