Book Image

Learning Vulkan

By : Parminder Singh
Book Image

Learning Vulkan

By: Parminder Singh

Overview of this book

Vulkan, the next generation graphics and compute API, is the latest offering by Khronos. This API is the successor of OpenGL and unlike OpenGL, it offers great flexibility and high performance capabilities to control modern GPU devices. With this book, you'll get great insights into the workings of Vulkan and how you can make stunning graphics run with minimum hardware requirements. We begin with a brief introduction to the Vulkan system and show you its distinct features with the successor to the OpenGL API. First, you will see how to establish a connection with hardware devices to query the available queues, memory types, and capabilities offered. Vulkan is verbose, so before diving deep into programing, you’ll get to grips with debugging techniques so even first-timers can overcome error traps using Vulkan’s layer and extension features. You’ll get a grip on command buffers and acquire the knowledge to record various operation commands into command buffer and submit it to a proper queue for GPU processing. We’ll take a detailed look at memory management and demonstrate the use of buffer and image resources to create drawing textures and image views for the presentation engine and vertex buffers to store geometry information. You'll get a brief overview of SPIR-V, the new way to manage shaders, and you'll define the drawing operations as a single unit of work in the Render pass with the help of attachments and subpasses. You'll also create frame buffers and build a solid graphics pipeline, as well as making use of the synchronizing mechanism to manage GPU and CPU hand-shaking. By the end, you’ll know everything you need to know to get your hands dirty with the coolest Graphics API on the block.
Table of Contents (18 chapters)
Learning Vulkan
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface

Vulkan and its evolution


It's almost a quarter-century since the famous OpenGL API came into existence, and it is still evolving. Internally, it is a pure state machine that contains several switches working in a binary state (on/off). These states are used to build dependency mapping in the driver to manage resources and control them in an optimal way to yield maximum performance. This state machine automates resource management implicitly, but it is not intelligent enough to capture application logic, which is the driving force behind resource management. As a result, there might be unexpected situations, such as the implementation going off, resulting in recompilation of the shaders even when the application has not requested it. In addition, the OpenGL API might be subject to other factors, such as unpredictable behavior, multithreading scalability, rendering glitches, and so on. Later in this chapter, we will compare OpenGL with the Vulkan API to understand the difference between the two.

Launched by Khronos in 2016, the Vulkan API has a revolutionary architecture that takes full advantage of modern graphics processor units to produce high-performance graphics and compute applications. If you are not aware of Khronos, it's an association of members and organizations that focus on producing open standards for royalty-free APIs. For more information, refer to https://www.khronos.org.

The original concept of Vulkan was designed and developed by AMD, based on their proprietary Mantle API. This API showcased cutting-edge capabilities through several games, thereby proving its revolutionary approach and fulfilling all the competitive demands of the industry. AMD made their Mantle API open source and donated it to Khronos. The Khronos consortium, with the help of many other hardware and software vendors, made collaborative efforts to release Vulkan.

Vulkan is not the only next-gen 3D graphics API; there are competitors, such as Microsoft's Direct-X 12 and Apple's Metal. However, Direct-X is limited to its Windows variants and Metal to Mac (OS X and iOS). Vulkan stands out in that respect. Its cross-platform nature supports almost all the available OS platforms; this list includes Windows (XP, Vista, 7, 8, and 10), Linux, Tizen, SteamOS, and Android.