compat.vulkan
#includeKhronos Vulkan loader — static ICD-dispatch library
#include <vulkan/vulkan.h>
mcpp add compat.vulkan@1.4.357.3
Usage
From this repository's own test project — built and run by CI, not written for the website.
// Behavioral test — verify compat.vulkan builds a working loader and that a
// consumer can link its trampolines.
//
// Everything asserted here is answered by the LOADER itself, before any ICD is
// involved, so it is meaningful on a CI runner with no GPU and no driver.
// That constraint is sharper than it looks: the loader advertises the WSI
// surface extensions only when some ICD supports them, so `VK_KHR_surface` is
// legitimately ABSENT on a driverless machine and asserting on it would just be
// testing the runner's hardware.
//
// HAVE_VULKAN_LOADER is set by THIS project's own [build] cxxflags. A consumer
// that keys its source off a dependency's presence has to declare that itself.
#if defined(HAVE_VULKAN_LOADER)
#include <vulkan/vulkan.h>
#endif
import std;
#if defined(HAVE_VULKAN_LOADER) && defined(_WIN32)
// Declared rather than taken from <windows.h>: two functions are needed, and
// the header's macros and min/max collide with `import std`. Both live in
// kernel32, which every Windows program already links.
extern "C" __declspec(dllimport) void* GetModuleHandleW(const wchar_t* name);
// …
tests/examples/vulkan/tests/loader.cpp · project tests/examples/vulkan
Build
- targets
vulkan (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
*/loader, */loader/generated, mcpp_generated
Sources (14)
*/loader/allocation.c*/loader/cJSON.c*/loader/debug_utils.c*/loader/extension_manual.c*/loader/gpa_helper.c*/loader/loader.c*/loader/loader_environment.c*/loader/loader_json.c*/loader/log.c*/loader/settings.c*/loader/terminator.c*/loader/trampoline.c*/loader/unknown_function_handling.c*/loader/wsi.c
Generated files
mcpp_generated/vulkan_import_anchor.cmcpp_generated/mcpp_vulkan_paths.h