Khronos Group выпустила Vulkan SDK с поддержкой трассировки лучей для консолей и ПК Статьи редакции
Теперь разработчикам будет проще добавлять реалистичные тени и отражения в игры без привязки к DirectX 12.
8.4K открытий
Quake II RTX
Консорциум Khronos Group выпустил обновлённую версию инструментария для разработчиков (SDK) для графического API Vulkan — теперь в него напрямую интегрировано всё необходимое для добавления эффектов аппаратной трассировки лучей в реальном времени.
Графический API Vulkan представляет собой открытый набор инструкций, который служит «прослойкой» между софтом (игрой) и железом (видеокартой). API «дружит» с видеокартами NVIDIA, AMD и даже консолями, включая PS5, Xbox Series и Nintendo Switch — это выгодно отличает его от DirectX 12 от Microsoft, который не поддерживается консолями Sony, Nintendo и ПК на Linux.
Формально поддержка трассировки и нескольких других продвинутых функций уже была доступна разработчикам, но требовала установки внешних библиотек и выполнения других «лишних» действий. Теперь же все инструменты будут под рукой — разработчики даже добавили возможность портировать уже отлаженную трассировку из версии игры для DirectX 12.
В Khronos Group уверены, что использование универсального API для всех игровых платформ позволит создавать игры с графикой нового поколения без привязки к оборудованию.
До выхода Vulkan Ray Tracing трассировка реализовывалась через DirectX Ray Tracing (DXR), который входит в пакет DirectX 12 Ultimate и поддерживается видеокартами NVIDIA GeForce RTX 20-й и 30-й серий, AMD Radeon RX 6000 и Xbox Series — но не на PS5.
Что касается проприетарных технологий вроде NVIDIA DLSS и будущего аналога от AMD, их можно будет добавить в Vulkan-версию игры так же, как это происходит с DXR-версией — они всё ещё будут ограничены конкретным оборудованием, под которое изначально создавались.
Кроме обновлённого SDK для разработчиков сегодня стали доступны драйверы для видеокарт GeForce RTX и Radeon RX 6000 с поддержкой Vulkan Ray Tracing — одной из первых игр с полной поддержкой технологии стала Quake II RTX, которая доступна в Steam бесплатно.
LunarG: Creator and Curator of the Vulkan SDK
Vulkan is a new generation graphics and compute API that provides high-efficiency, cross-platform access to modern graphics processing units (GPUs), which are used in a wide variety of devices from PCs and consoles to mobile phones and embedded platforms. The Vulkan API was created by the Khronos Group, a consortium of technology hardware and software companies.
In addition to providing 3D graphics software solutions and consulting services, LunarG is also the creator and curator of the Vulkan software development kit (SDK). The Vulkan SDK is a collection of essential tools used by developers to assist in development and debugging of Vulkan applications. LunarG works closely with the Khronos Vulkan working group to provide ongoing enhancements to the Vulkan SDK components as the Vulkan API continues to evolve.
LunarG recently donated this open-source SDK, which is available for the Windows ® , Linux, and macOS ® operating systems, to the Khronos Group. The SDK is open source and freely available to all.
The Vulkan SDK Includes:
Vulkan Loader
The Vulkan SDK includes the Khronos‐branded Vulkan loader binary for Linux and macOS. On Windows, the Vulkan Loader is delivered with the hardware vendor driver update packages. The loader discovers and manages the Vulkan devices and layers available to the application.
Vulkan Application Developer Tools
The SDK provides you with tools to assist the developer during application development. Common tools are the Validation Layers, apidump, vulkaninfo, and capture/replay tools.
Vulkan Capture Tools
The capture and replay tools allow you to capture API calls in binary format and play them back. This is useful for sharing traces when debugging your applications with third parties (such as IHVs) without having to share the application. For application developers it can be useful to validate that the application is executing Vulkan API usage as expected.
SPIR‐V™ Tools
SPIR‐V is a new binary intermediate representation (IR) for graphical shaders and compute kernels. The Vulkan graphics API requires the SPIR‐V format for all shaders. To help you meet this requirement, the SDK includes tools for proper shader generation, GLSL and HLSL conversion, inspection, and compression improvement.
SDK Documentation
Each SDK is for a Vulkan header version. Online documentation for all the tools in the SDK is included as well as builds of the Vulkan specification for the header version.
Vulkan Samples and Tutorial
An online Vulkan tutorial is provided that will take the user through the steps to render a basic object on the screen. In addition, there are simple Vulkan samples that demonstrate the use of some of the Vulkan API calls.
Benefits of Using the SDK
- Provides your developers with the essential tools needed for developing Vulkan applications
- Streamlines the process of developing applications in Vulkan by delivering pre-built versions of key developer’s tools relative to the Vulkan header version
Our Work with the Khronos Group
LunarG has a long-standing partnership with the Khronos Group, a technology consortium that works to develop advanced, royalty-free, acceleration standards for 3D graphics. LunarG is also actively involved in influencing the Vulkan specification process, and in representing its clients’ needs at Vulkan Working Group meetings.
Vulkan SDK FAQ
Find answers to your most pressing questions about the Vulkan SDK.
White Paper
Vulkan SDK Version Compatibility
Find out why there’s no longer a need for a Vulkan SDK based on 1.0 headers.
Need Help with
3D Graphics Software?
Interested in LunarG software services or have a unique need that you don’t see represented here? Let’s talk about your project.
Copyright 2023 LunarG, Inc. All Rights Reserved. Privacy Terms Site Map
Khronos, the Khronos Group, SPIR-V and Vulkan are registered trademarks of the Khronos Group Inc. Windows is a registered trademark of Microsoft Corporation. macOS is a registered trademark of Apple, Inc. All other trademarks are trademarks or registered trademarks of their respective owners.
The Native Activity
To get a Vulkan surface up and running, we will use native code exclusively, using NativeActivity. NativeActivity is a built-in Java class in Android which lets us implement applications purely in native code. This is very useful for Vulkan since in order to create a Vulkan swapchain, we need an ANativeWindow handle, which NativeActivity will neatly give us.
We set up a sample with this AndroidManifest.xml
The important part here is that we set android.app.NativeActivity as our launch activity, where we set the android.app.lib_name meta-data. This is so that the Android class can load our application. Using android:value=”native”, Android will load libnative.so. We also set the android:hasCode=”false” field, since we will not need to build any Java code ourselves.
Inside libnative.so, we need to include some glue code which will translate Java callbacks over to a classic main loop.
// platform/android/android.cpp
#include “android_native_app_glue.h”
void android_main(android_app *state)
// Implement application here!
ALooper_pollAll(&event);
event ->handle();
In this mainloop, we will poll the android looper to receive and handle events. One of the events we will handle is obtaining a window handle. This window handle is required for creating a Vulkan swapchain.
static void engineHandleCmd(android_app *pApp, int32_t cmd)
switch (cmd)
case APP_CMD_INIT_WINDOW:
ANativeWindow *pWindow = state->pApp->window;
// Pass pWindow on to the application somehow.
Bringing up Vulkan Instance and Device
After we have obtained a native window, we can create a Vulkan instance. The Vulkan instance is our first entry point into Vulkan.
VkApplicationInfo app = < VK_STRUCTURE_TYPE_APPLICATION_INFO >;
app.pApplicationName = “Mali SDK” ;
app.applicationVersion = 0;
app.pEngineName = “Mali SDK” ;
app.engineVersion = 0;
// API version used. What matters for compatibility is major (1) and minor (0) versions.
app.apiVersion = VK_MAKE_VERSION(1, 0, 13);
VkInstanceCreateInfo instanceInfo = < VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO >;
instanceInfo.pApplicationInfo = &app;
if (useInstanceExtensions)
instanceInfo.enabledExtensionCount = requiredInstanceExtensions.size();
instanceInfo.ppEnabledExtensionNames = requiredInstanceExtensions.data();
VkResult res = vkCreateInstance(&instanceInfo, nullptr , &instance);
The Vulkan instance represents the “loader”. The Vulkan loader serves as a common entrypoint for Vulkan on a particular platform, and it is vendor-agnostic. From the instance, we can query the available GPUs on the system.
uint32_t gpuCount = 0;
VK_CHECK(vkEnumeratePhysicalDevices(instance, &gpuCount, nullptr ));
if (gpuCount < 1)
LOGE( "Failed to enumerate Vulkan physical device.\n" );
return RESULT_ERROR_GENERIC;
vector
VK_CHECK(vkEnumeratePhysicalDevices(instance, &gpuCount, gpus.data()));
From here we can query the VkPhysicalDevice about particular features if we want to select one GPU among many. Once we have decided on a GPU to use, we can create a device from it. The Vulkan device will from this point on serve as our entry for dispatching work to the GPU.
static const float one = 1.0f;
VkDeviceQueueCreateInfo queueInfo = < VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO >;
queueInfo.queueFamilyIndex = graphicsQueueIndex;
queueInfo.queueCount = 1;
queueInfo.pQueuePriorities = &one;
VkPhysicalDeviceFeatures features = < false >;
VkDeviceCreateInfo deviceInfo = < VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO >;
deviceInfo.queueCreateInfoCount = 1;
deviceInfo.pQueueCreateInfos = &queueInfo;
if (useDeviceExtensions)
deviceInfo.enabledExtensionCount = requiredDeviceExtensions.size();
deviceInfo.ppEnabledExtensionNames = requiredDeviceExtensions.data();
deviceInfo.pEnabledFeatures = &features;
VK_CHECK(vkCreateDevice(gpu, &deviceInfo, nullptr , &device));
if (FAILED(loadDeviceSymbols()))
return RESULT_ERROR_GENERIC;
vkGetDeviceQueue(device, graphicsQueueIndex, 0, &queue);
Creating a Vulkan Swapchain
Now that we have a device, we can create a swapchain. A swapchain is the way for Vulkan applications to render to the screen. Vulkan can be used completely without a screen for off-line processing, and rendering to screen is done via a common extension, VK_KHR_swapchain.
First, we need to create a Vulkan surface.
При подготовке материала использовались источники:
https://dtf.ru/hard/287997-khronos-group-vypustila-vulkan-sdk-s-podderzhkoy-trassirovki-luchey-dlya-konsoley-i-pk
https://arm-software.github.io/vulkan-sdk/creating_vulkan_window.html