android / android/ndk

[FR] Include vulkan/vulkan.hpp C++ wrappers

Open
#945 1 comment 7 reactions 0 assignees View on GitHub
c++ wrapper request enhancement
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

The vulkan header files included in `/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan` do not include the `vulkan.hpp` C++ wrapper.

The feature request is to add a `vulkan.hpp` header file compatible with the Vulkan version used by the NDK.

**Additional context**

Currently in NDK r19c and r20-beta1, there is a `vulkan.hpp` header at `/sources/third_party/vulkan/src/include/vulkan`. However, this header file is not compatible with the C header file included in `/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan` as the header versions are different.

For NDK r19c, the C header at `/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan/vulkan.h`, line 46 dfines:
```
// Version of this file
#define VK_HEADER_VERSION 82
```
while the C++ wrapper at `/sources/third_party/vulkan/src/include/vulkan/vulkan.hpp`, line 39, expects a different version:
```
static_assert( VK_HEADER_VERSION == 69 , "Wrong VK_HEADER_VERSION!" );
```

Using this wrapper version will trigger the static_assert.

**Alternative solutions**

One alternative solution is to copy the compatible `vulkan.hpp` from the LunarG SDK to `/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan/`. For NDK r19c, [LunarG 1.1.82.1](https://vulkan.lunarg.com/sdk/home#sdk/downloadConfirm/1.1.82.1/linux/vulkansdk-linux-x86_64-1.1.82.1.tar.gz) contains a compatible header.

Contributor guide

Open the contributing guide

Research direction

Start by comparing the Vulkan headers in /toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan with sources/third_party/vulkan/src/include/vulkan/vulkan.hpp, especially their VK_HEADER_VERSION values. Check the compatible LunarG 1.1.82.1 header as described in the issue. Done means the sysroot provides a vulkan.hpp compatible with its vulkan.h without triggering the version assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.