Rihen Rihen NkentseuDocumentation
Development version, not published. Built from main: it shows what is coming (fixes, descriptions written since the last tag) and can change with every commit. Go to the stable version 0.1.0-beta.11

NkCGXDetect.h

Include
#include "NKPlatform/NkCGXDetect.h"
Namespace
nkentseu::graphics
Link (Jenga)
nkentseudependson(["NKPlatform"])

Types

NkGraphicsApiSupported graphics API types
NkGPUVendorGPU vendors identified by their PCI Vendor ID
NkGPUTypeGPU types by architecture category

Functions · 6

ToStringConverts a NkGraphicsApi enum to a string
ToStringConverts a NkGPUVendor enum to a string
ToStringConverts a NkGPUType enum to a string
IsAPIAvailableChecks at compile time whether a graphics API is available
GetDefaultAPIGets the default graphics API recommended for the platform
GetModernAPIGets the most modern graphics API available on the platform

Macros · 65

NKENTSEU_GRAPHICS_D3D11_AVAILABLEDirect3D 11 available on Windows
NKENTSEU_GRAPHICS_D3D12_AVAILABLEDirect3D 12 available on Windows 10+
NKENTSEU_GRAPHICS_OPENGL_AVAILABLEOpenGL available on Windows
NKENTSEU_GRAPHICS_VULKAN_AVAILABLEVulkan available on Windows
NKENTSEU_GRAPHICS_METAL_AVAILABLEMetal available on macOS
NKENTSEU_GRAPHICS_OPENGL_DEPRECATEDDefined, with no value, on macOS: Apple marks OpenGL as deprecated there.
NKENTSEU_GRAPHICS_VULKAN_VIA_MOLTENVKDefined, with no value, on Apple systems: Vulkan goes through MoltenVK there.
NKENTSEU_GRAPHICS_GLES3_AVAILABLEDefined, with no value, when OpenGL ES 3 is available on the target.
NKENTSEU_GRAPHICS_WEBGL2_AVAILABLEWebGL 2.0 available through Emscripten
NKENTSEU_GRAPHICS_WEBGPU_AVAILABLEWebGPU available (experimental support)
NKENTSEU_GRAPHICS_GNM_AVAILABLEGNM (Sony API) available on PS5
NKENTSEU_GRAPHICS_NVN_AVAILABLENVN (NVIDIA API) available on Nintendo Switch
NKENTSEU_GRAPHICS_DEFAULTThe graphics API chosen by default for the target (a NkGraphicsApi value).
NKENTSEU_GRAPHICS_MODERNThe preferred modern graphics API on the target (a NkGraphicsApi value).
NKENTSEU_D3D11_ONLYKeeps its argument when Direct3D 11 is available on the target, removes it otherwise.
NKENTSEU_NOT_D3D11Removes its argument when Direct3D 11 is available on the target, keeps it otherwise.
NKENTSEU_D3D12_ONLYKeeps its argument when Direct3D 12 is available on the target, removes it otherwise.
NKENTSEU_NOT_D3D12Removes its argument when Direct3D 12 is available on the target, keeps it otherwise.
NKENTSEU_VULKAN_ONLYKeeps its argument when Vulkan is available on the target, removes it otherwise.
NKENTSEU_NOT_VULKANRemoves its argument when Vulkan is available on the target, keeps it otherwise.
NKENTSEU_METAL_ONLYKeeps its argument when Metal is available on the target, removes it otherwise.
NKENTSEU_NOT_METALRemoves its argument when Metal is available on the target, keeps it otherwise.
NKENTSEU_OPENGL_ONLYKeeps its argument when OpenGL is available on the target, removes it otherwise.
NKENTSEU_NOT_OPENGLRemoves its argument when OpenGL is available on the target, keeps it otherwise.
NKENTSEU_GLES_ONLYKeeps its argument when OpenGL ES 3 is available on the target, removes it otherwise.
NKENTSEU_NOT_GLESRemoves its argument when OpenGL ES 3 is available on the target, keeps it otherwise.
NKENTSEU_WEBGL_ONLYKeeps its argument when WebGL 2 is available on the target, removes it otherwise.
NKENTSEU_NOT_WEBGLRemoves its argument when WebGL 2 is available on the target, keeps it otherwise.
NKENTSEU_WEBGPU_ONLYKeeps its argument when WebGPU is available on the target, removes it otherwise.
NKENTSEU_NOT_WEBGPURemoves its argument when WebGPU is available on the target, keeps it otherwise.
NKENTSEU_GNM_ONLYKeeps its argument when GNM (PlayStation) is available on the target, removes it otherwise.
NKENTSEU_NOT_GNMRemoves its argument when GNM (PlayStation) is available on the target, keeps it otherwise.
NKENTSEU_NVN_ONLYKeeps its argument when NVN (Nintendo Switch) is available on the target, removes it otherwise.
NKENTSEU_NOT_NVNRemoves its argument when NVN (Nintendo Switch) is available on the target, keeps it otherwise.
NKENTSEU_COMPUTE_CUDA_AVAILABLECUDA compiler detected: NVIDIA CUDA available
NKENTSEU_COMPUTE_AVAILABLEDefined, with no value, when the code is compiled for CUDA, OpenCL or SYCL.
NKENTSEU_COMPUTE_OPENCL_AVAILABLEOpenCL C version macro detected: OpenCL available
NKENTSEU_COMPUTE_SYCL_AVAILABLESYCL language macros detected: SYCL available
NKENTSEU_CUDA_ONLYKeeps its argument when the code is compiled for CUDA, removes it otherwise.
NKENTSEU_NOT_CUDARemoves its argument when the code is compiled for CUDA, keeps it otherwise.
NKENTSEU_OPENCL_ONLYKeeps its argument when the code is compiled for OpenCL, removes it otherwise.
NKENTSEU_NOT_OPENCLRemoves its argument when the code is compiled for OpenCL, keeps it otherwise.
NKENTSEU_SYCL_ONLYKeeps its argument when the code is compiled for SYCL, removes it otherwise.
NKENTSEU_NOT_SYCLRemoves its argument when the code is compiled for SYCL, keeps it otherwise.
NKENTSEU_DISPLAY_WAYLANDWayland display server detected
NKENTSEU_DISPLAY_XCBXCB (X C Binding) detected: low-level X11 interface
NKENTSEU_DISPLAY_XLIBXlib detected: traditional X11 interface
NKENTSEU_GPU_VENDOR_NVIDIA_IDNVIDIA Corporation
NKENTSEU_GPU_VENDOR_AMD_IDAMD / ATI Technologies
NKENTSEU_GPU_VENDOR_INTEL_IDIntel Corporation
NKENTSEU_GPU_VENDOR_ARM_IDARM Holdings (Mali)
NKENTSEU_GPU_VENDOR_QUALCOMM_IDQualcomm (Adreno)
NKENTSEU_GPU_VENDOR_APPLE_IDApple Inc.
NKENTSEU_GPU_VENDOR_IMGTEC_IDImagination Technologies (PowerVR)
NKENTSEU_GPU_VENDOR_BROADCOM_IDBroadcom (VideoCore)
NKENTSEU_GPU_VENDOR_MICROSOFT_IDMicrosoft (WARP software renderer)
NKENTSEU_GFX_NONENo API (invalid state)
NKENTSEU_GFX_VULKANVulkan
NKENTSEU_GFX_METALMetal
NKENTSEU_GFX_DIRECTXDirect3D (11 or 12)
NKENTSEU_GFX_OPENGLOpenGL / OpenGL ES
NKENTSEU_GFX_SOFTWARESoftware renderer (fallback)
NKENTSEU_GFX_VERSION_CALCEncodes a (major, minor) version as a 32-bit integer
NKENTSEU_GFX_ACTIVEThe active graphics API (an NKENTSEU_GFX_* value), forced by NKENTSEU_GFX_FORCE or detected.
NKENTSEU_GFX_VERSIONThe version of the active graphics API, computed by NKENTSEU_GFX_VERSION_CALC.

Member details

NKENTSEU_GRAPHICS_D3D11_AVAILABLE

#
macro
#define NKENTSEU_GRAPHICS_D3D11_AVAILABLE

Direct3D 11 available on Windows

NKENTSEU_GRAPHICS_D3D12_AVAILABLE

#
macro
#define NKENTSEU_GRAPHICS_D3D12_AVAILABLE

Direct3D 12 available on Windows 10+

NKENTSEU_GRAPHICS_OPENGL_AVAILABLE

#
macro
#define NKENTSEU_GRAPHICS_OPENGL_AVAILABLE

OpenGL available on Windows

NKENTSEU_GRAPHICS_VULKAN_AVAILABLE

#
macro
#define NKENTSEU_GRAPHICS_VULKAN_AVAILABLE

Vulkan available on Windows

NKENTSEU_GRAPHICS_METAL_AVAILABLE

#
macro
#define NKENTSEU_GRAPHICS_METAL_AVAILABLE

Metal available on macOS

NKENTSEU_GRAPHICS_OPENGL_DEPRECATED

#
macro
#define NKENTSEU_GRAPHICS_OPENGL_DEPRECATED

Defined, with no value, on macOS: Apple marks OpenGL as deprecated there.

NKENTSEU_GRAPHICS_VULKAN_VIA_MOLTENVK

#
macro
#define NKENTSEU_GRAPHICS_VULKAN_VIA_MOLTENVK

Defined, with no value, on Apple systems: Vulkan goes through MoltenVK there.

NKENTSEU_GRAPHICS_GLES3_AVAILABLE

#
macro
#define NKENTSEU_GRAPHICS_GLES3_AVAILABLE

Defined, with no value, when OpenGL ES 3 is available on the target.

NKENTSEU_GRAPHICS_WEBGL2_AVAILABLE

#
macro
#define NKENTSEU_GRAPHICS_WEBGL2_AVAILABLE

WebGL 2.0 available through Emscripten

NKENTSEU_GRAPHICS_WEBGPU_AVAILABLE

#
macro
#define NKENTSEU_GRAPHICS_WEBGPU_AVAILABLE

WebGPU available (experimental support)

NKENTSEU_GRAPHICS_GNM_AVAILABLE

#
macro
#define NKENTSEU_GRAPHICS_GNM_AVAILABLE

GNM (Sony API) available on PS5

NKENTSEU_GRAPHICS_NVN_AVAILABLE

#
macro
#define NKENTSEU_GRAPHICS_NVN_AVAILABLE

NVN (NVIDIA API) available on Nintendo Switch

ToString

#
functiongeneric (template)
template <typename CharT = char> inline constexpr const CharT *ToString(NkGraphicsApi api) noexcept

Converts a NkGraphicsApi enum to a string

Parameters

NameTypeRoleDefault
apiNkGraphicsApi

ToString

#
functiongeneric (template)
template <typename CharT = char> inline constexpr const CharT *ToString(NkGPUVendor vendor) noexcept

Converts a NkGPUVendor enum to a string

Parameters

NameTypeRoleDefault
vendorNkGPUVendor

ToString

#
functiongeneric (template)
template <typename CharT = char> inline constexpr const CharT *ToString(NkGPUType type) noexcept

Converts a NkGPUType enum to a string

Parameters

NameTypeRoleDefault
typeNkGPUType

IsAPIAvailable

#
functiongeneric (template)
template <NkGraphicsApi API> inline constexpr bool IsAPIAvailable() noexcept

Checks at compile time whether a graphics API is available

@codefragment, not compiled
// Sélection compile-time du backend
template <nkentseu::platform::graphics::NkGraphicsApi API>
void CreateRenderer() {
    static_assert(
        nkentseu::platform::graphics::IsAPIAvailable<API>(),
        "Selected graphics API not available on this platform"
    );
    // ... initialisation spécifique à l'API
}

GetDefaultAPI

#
functiongeneric (template)
template <typename = void> inline constexpr NkGraphicsApi GetDefaultAPI() noexcept

Gets the default graphics API recommended for the platform

GetModernAPI

#
functiongeneric (template)
template <typename = void> inline constexpr NkGraphicsApi GetModernAPI() noexcept

Gets the most modern graphics API available on the platform

NKENTSEU_GRAPHICS_DEFAULT

#
macro
#define NKENTSEU_GRAPHICS_DEFAULT

The graphics API chosen by default for the target (a NkGraphicsApi value).

NKENTSEU_GRAPHICS_MODERN

#
macro
#define NKENTSEU_GRAPHICS_MODERN

The preferred modern graphics API on the target (a NkGraphicsApi value).

NKENTSEU_D3D11_ONLY

#
macro
#define NKENTSEU_D3D11_ONLY(...)

Keeps its argument when Direct3D 11 is available on the target, removes it otherwise.

NKENTSEU_NOT_D3D11

#
macro
#define NKENTSEU_NOT_D3D11(...)

Removes its argument when Direct3D 11 is available on the target, keeps it otherwise.

NKENTSEU_D3D12_ONLY

#
macro
#define NKENTSEU_D3D12_ONLY(...)

Keeps its argument when Direct3D 12 is available on the target, removes it otherwise.

NKENTSEU_NOT_D3D12

#
macro
#define NKENTSEU_NOT_D3D12(...)

Removes its argument when Direct3D 12 is available on the target, keeps it otherwise.

NKENTSEU_VULKAN_ONLY

#
macro
#define NKENTSEU_VULKAN_ONLY(...)

Keeps its argument when Vulkan is available on the target, removes it otherwise.

NKENTSEU_NOT_VULKAN

#
macro
#define NKENTSEU_NOT_VULKAN(...)

Removes its argument when Vulkan is available on the target, keeps it otherwise.

NKENTSEU_METAL_ONLY

#
macro
#define NKENTSEU_METAL_ONLY(...)

Keeps its argument when Metal is available on the target, removes it otherwise.

NKENTSEU_NOT_METAL

#
macro
#define NKENTSEU_NOT_METAL(...)

Removes its argument when Metal is available on the target, keeps it otherwise.

NKENTSEU_OPENGL_ONLY

#
macro
#define NKENTSEU_OPENGL_ONLY(...)

Keeps its argument when OpenGL is available on the target, removes it otherwise.

NKENTSEU_NOT_OPENGL

#
macro
#define NKENTSEU_NOT_OPENGL(...)

Removes its argument when OpenGL is available on the target, keeps it otherwise.

NKENTSEU_GLES_ONLY

#
macro
#define NKENTSEU_GLES_ONLY(...)

Keeps its argument when OpenGL ES 3 is available on the target, removes it otherwise.

NKENTSEU_NOT_GLES

#
macro
#define NKENTSEU_NOT_GLES(...)

Removes its argument when OpenGL ES 3 is available on the target, keeps it otherwise.

NKENTSEU_WEBGL_ONLY

#
macro
#define NKENTSEU_WEBGL_ONLY(...)

Keeps its argument when WebGL 2 is available on the target, removes it otherwise.

NKENTSEU_NOT_WEBGL

#
macro
#define NKENTSEU_NOT_WEBGL(...)

Removes its argument when WebGL 2 is available on the target, keeps it otherwise.

NKENTSEU_WEBGPU_ONLY

#
macro
#define NKENTSEU_WEBGPU_ONLY(...)

Keeps its argument when WebGPU is available on the target, removes it otherwise.

NKENTSEU_NOT_WEBGPU

#
macro
#define NKENTSEU_NOT_WEBGPU(...)

Removes its argument when WebGPU is available on the target, keeps it otherwise.

NKENTSEU_GNM_ONLY

#
macro
#define NKENTSEU_GNM_ONLY(...)

Keeps its argument when GNM (PlayStation) is available on the target, removes it otherwise.

NKENTSEU_NOT_GNM

#
macro
#define NKENTSEU_NOT_GNM(...)

Removes its argument when GNM (PlayStation) is available on the target, keeps it otherwise.

NKENTSEU_NVN_ONLY

#
macro
#define NKENTSEU_NVN_ONLY(...)

Keeps its argument when NVN (Nintendo Switch) is available on the target, removes it otherwise.

NKENTSEU_NOT_NVN

#
macro
#define NKENTSEU_NOT_NVN(...)

Removes its argument when NVN (Nintendo Switch) is available on the target, keeps it otherwise.

NKENTSEU_COMPUTE_CUDA_AVAILABLE

#
macro
#define NKENTSEU_COMPUTE_CUDA_AVAILABLE

CUDA compiler detected: NVIDIA CUDA available

NKENTSEU_COMPUTE_AVAILABLE

#
macro
#define NKENTSEU_COMPUTE_AVAILABLE

Defined, with no value, when the code is compiled for CUDA, OpenCL or SYCL.

NKENTSEU_COMPUTE_OPENCL_AVAILABLE

#
macro
#define NKENTSEU_COMPUTE_OPENCL_AVAILABLE

OpenCL C version macro detected: OpenCL available

NKENTSEU_COMPUTE_SYCL_AVAILABLE

#
macro
#define NKENTSEU_COMPUTE_SYCL_AVAILABLE

SYCL language macros detected: SYCL available

NKENTSEU_CUDA_ONLY

#
macro
#define NKENTSEU_CUDA_ONLY(...)

Keeps its argument when the code is compiled for CUDA, removes it otherwise.

NKENTSEU_NOT_CUDA

#
macro
#define NKENTSEU_NOT_CUDA(...)

Removes its argument when the code is compiled for CUDA, keeps it otherwise.

NKENTSEU_OPENCL_ONLY

#
macro
#define NKENTSEU_OPENCL_ONLY(...)

Keeps its argument when the code is compiled for OpenCL, removes it otherwise.

NKENTSEU_NOT_OPENCL

#
macro
#define NKENTSEU_NOT_OPENCL(...)

Removes its argument when the code is compiled for OpenCL, keeps it otherwise.

NKENTSEU_SYCL_ONLY

#
macro
#define NKENTSEU_SYCL_ONLY(...)

Keeps its argument when the code is compiled for SYCL, removes it otherwise.

NKENTSEU_NOT_SYCL

#
macro
#define NKENTSEU_NOT_SYCL(...)

Removes its argument when the code is compiled for SYCL, keeps it otherwise.

NKENTSEU_DISPLAY_WAYLAND

#
macro
#define NKENTSEU_DISPLAY_WAYLAND

Wayland display server detected

NKENTSEU_DISPLAY_XCB

#
macro
#define NKENTSEU_DISPLAY_XCB

XCB (X C Binding) detected: low-level X11 interface

NKENTSEU_DISPLAY_XLIB

#
macro
#define NKENTSEU_DISPLAY_XLIB

Xlib detected: traditional X11 interface

NKENTSEU_GPU_VENDOR_NVIDIA_ID

#
macro
#define NKENTSEU_GPU_VENDOR_NVIDIA_ID

NVIDIA Corporation

NKENTSEU_GPU_VENDOR_AMD_ID

#
macro
#define NKENTSEU_GPU_VENDOR_AMD_ID

AMD / ATI Technologies

NKENTSEU_GPU_VENDOR_INTEL_ID

#
macro
#define NKENTSEU_GPU_VENDOR_INTEL_ID

Intel Corporation

NKENTSEU_GPU_VENDOR_ARM_ID

#
macro
#define NKENTSEU_GPU_VENDOR_ARM_ID

ARM Holdings (Mali)

NKENTSEU_GPU_VENDOR_QUALCOMM_ID

#
macro
#define NKENTSEU_GPU_VENDOR_QUALCOMM_ID

Qualcomm (Adreno)

NKENTSEU_GPU_VENDOR_APPLE_ID

#
macro
#define NKENTSEU_GPU_VENDOR_APPLE_ID

Apple Inc.

NKENTSEU_GPU_VENDOR_IMGTEC_ID

#
macro
#define NKENTSEU_GPU_VENDOR_IMGTEC_ID

Imagination Technologies (PowerVR)

NKENTSEU_GPU_VENDOR_BROADCOM_ID

#
macro
#define NKENTSEU_GPU_VENDOR_BROADCOM_ID

Broadcom (VideoCore)

NKENTSEU_GPU_VENDOR_MICROSOFT_ID

#
macro
#define NKENTSEU_GPU_VENDOR_MICROSOFT_ID

Microsoft (WARP software renderer)

NKENTSEU_GFX_NONE

#
macro
#define NKENTSEU_GFX_NONE

No API (invalid state)

NKENTSEU_GFX_VULKAN

#
macro
#define NKENTSEU_GFX_VULKAN

Vulkan

NKENTSEU_GFX_METAL

#
macro
#define NKENTSEU_GFX_METAL

Metal

NKENTSEU_GFX_DIRECTX

#
macro
#define NKENTSEU_GFX_DIRECTX

Direct3D (11 or 12)

NKENTSEU_GFX_OPENGL

#
macro
#define NKENTSEU_GFX_OPENGL

OpenGL / OpenGL ES

NKENTSEU_GFX_SOFTWARE

#
macro
#define NKENTSEU_GFX_SOFTWARE

Software renderer (fallback)

NKENTSEU_GFX_VERSION_CALC

#
macro
#define NKENTSEU_GFX_VERSION_CALC(major, minor)

Encodes a (major, minor) version as a 32-bit integer

NKENTSEU_GFX_ACTIVE

#
macro
#define NKENTSEU_GFX_ACTIVE

The active graphics API (an NKENTSEU_GFX_* value), forced by NKENTSEU_GFX_FORCE or detected.

NKENTSEU_GFX_VERSION

#
macro
#define NKENTSEU_GFX_VERSION

The version of the active graphics API, computed by NKENTSEU_GFX_VERSION_CALC.