Chapter 3. Shaking Hands with the Device

With the knowledge we gained from the last two chapters, we have now reached a level where we can start Vulkan programming from scratch. These two chapters laid the foundation and helped us understand the basic fundamentals of this revolutionary API. Now, at a higher level, we understand the motivation behind this technology, its core blocks, and the associated functionalities and terminologies. In addition, we walked through Vulkan pseudocoding and built a very simple application to understand and visualize the Vulkan programming model.

From this chapter onward, we will dive into the core of Vulkan programming and start transforming our Hello World!!! pseudocode into a real-world executable sample.

Note

All the chapters in this book are designed and programmed carefully in a structured way; every new chapter is dependent on the previous one. You are advised to follow the sequence of the chapters for an efficient learning experience.

In this chapter, we will cover the following topics:

  • Getting started with the LunarG SDK
  • Setting up the first project with CMake
  • An introduction to layers and extensions
  • Creating a Vulkan instance
  • Understanding physical and logical devices
  • Understanding queues and queue families
  • Implementing the device and queues all together

Getting started with the LunarG SDK

All the chapters in this book use the LunarG SDK for Vulkan programming. This SDK can be downloaded from https://vulkan.lunarg.com; you'll need a LunarG account to do this.

The SDK's default installation path always locates to C:VulkanSDK [version]. Upon successful installation, the SDK's Bin directory location is added to the $PATH environment variable (C:VulkanSDK1.0.26.0Bin). In addition, the VK_SDK_PATH environment variable is added, pointing to the SDK's path (C:VulkanSDK1.0.26.0).

The installation will also add the Vulkan loader (vulkan-1.dll) to C:WindowsSystem32. Based on the window target, the loader will be either a 32-bit or 64-bit DLL.

The following are some general terms that will be commonly used throughout the chapter:

Term

Description

ICD

This is the abbreviation for Installable Client Driver. It is a Vulkan-compatible display driver. Multiple ICDs--for example, NVIDIA and Intel drivers--can coexist without interfering with each other.

Layers

These are pluggable components that either hook or intercept Vulkan commands. They provide services such as debugging, validation, tracing, and so on.

Loader

A loader's job is to locate the display driver and expose the layer's libraries in a platform-independent way. On Windows, the load library (vulkan-1.dll) uses registries to locate ICD and layer configurations.

The following are the folder contencified in the highlighted part of the following code.ts of the LunarG SDK along with the respective descriptions:

Directory

Description

Bin and Bin32

These contain the 32-bit (the Bin32 folder) and 64-bit (the Bin folder) release build of the executable and loader. They also contain the libraries of layers and tools.

Config

This is meant to store different Vulkan configurations. For example, it contains the vk_layer_settings.txt file, which is used to set configuration parameters at different validation layers. These configurations can dynamically affect the layers.

Demo

This is the Vulkan demo source for the cube, tri, and vulkaninfo programs.

Doc

This refers to specifications, manuals, release notes, and other important pieces of documentation.

glslang

This contains the source and headers for glslang. It provides a frontend parser for GLSL and a standalone wrapper tool called glslangValidator for shader validation.

Include

This contains the necessary header files that help the Vulkan application to be built and compiled.

Runtime

installer

The Vulkan runtime installer offers Vulkan runtime libraries that can be included by a Vulkan application or driver. Refer to the README.txt file for more information.

Source

This contains the source implementation for loader (vulkan-1.dll) and layer libraries.

spir-v tools

This refers to the source code and header files for SPIR-V tools.

Note

The installation of multiple SDKs does not affect other installations. The $PATH variable points to the most recently installed SDK version.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.37.191