jp7677 / dxvk-nvapi

Alternative NVAPI implementation on top of DXVK.
MIT License
353 stars 32 forks source link

sysinfo: Replace deprecated Vulkan macros #173

Closed jp7677 closed 1 month ago

jp7677 commented 1 month ago

Unfortunately we cannot just use the newer Vulkan macros since the major version for the NVIDIA driver needs 10 bits whereas the newer Vulkan macro for the major version truncates to 7 bits.

From vulkan_core.h:

// DEPRECATED: This define is deprecated. VK_API_VERSION_MAJOR should be used instead.
#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22U)

#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22U) & 0x7FU)

The newer VK_API_VERSION_MAJOR cuts after 7 bits due to introduction of the variant number, this conflicts with the 10 bits needed for the NVIDIA major version.

Inspired by https://github.com/doitsujin/dxvk/pull/4001

jp7677 commented 1 month ago

Is this something worth writing tests for?

We already somewhat cover it indirectly https://github.com/jp7677/dxvk-nvapi/blob/master/tests/nvapi_sysinfo.cpp#L202 but yeah good idea actually