Vulkan¶
Vulkan core functionality.
Overview¶
Typical use cases:
Providing core Vulkan utility functions
Header¶
<RaeptorCogs/GAPI/Vulkan/Core/Vulkan.hpp>
Metadata¶
- Author
Estorc
- Version
v1.0
- Copyright
Copyright (c) 2025 Estorc MIT License.
Functions¶
Function |
Description |
|---|---|
|
Check if a given VkFormat is an sRGB format. |
|
Check if the requested validation layers are supported. |
|
Find the best surface format for the given physical device and surface. |
|
Find a supported depth format. |
|
Rate the suitability of a Vulkan physical device. |
-
inline bool IsSRGBFormat(VkFormat format)¶
Check if a given VkFormat is an sRGB format.
bool isSRGB = RaeptorCogs::GAPI::Vulkan::IsSRGBFormat(VK_FORMAT_R8G8B8A8_SRGB);
- Parameters:
format – The VkFormat to check.
- Returns:
true if the format is sRGB, false otherwise.
-
bool checkValidationLayerSupport(const std::vector<const char*> validationLayers)¶
Check if the requested validation layers are supported.
std::vector<const char*> layers = { "VK_LAYER_KHRONOS_validation" }; bool supported = RaeptorCogs::GAPI::Vulkan::checkValidationLayerSupport(layers);
- Parameters:
validationLayers – List of validation layer names to check.
- Returns:
true if all requested layers are supported, false otherwise.
-
VkSurfaceFormatKHR findBestSurfaceFormat(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, const std::vector<VkFormat> &candidates = {VK_FORMAT_B8G8R8A8_SRGB, VK_FORMAT_R8G8B8A8_SRGB, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM})¶
Find the best surface format for the given physical device and surface.
VkSurfaceFormatKHR surfaceFormat = RaeptorCogs::GAPI::Vulkan::findBestSurfaceFormat(physicalDevice, surface);
- Parameters:
physicalDevice – The Vulkan physical device.
surface – The Vulkan surface.
candidates – Optional list of candidate formats to consider.
- Returns:
VkSurfaceFormatKHR The best matching surface format.
-
VkFormat findDepthFormat(VkPhysicalDevice physicalDevice)¶
Find a supported depth format.
VkFormat depthFormat = RaeptorCogs::GAPI::Vulkan::findDepthFormat(physicalDevice);
- Parameters:
physicalDevice – The Vulkan physical device.
- Throws:
std::runtime_error – if no supported format is found.
- Returns:
VkFormat The first supported format from the candidates.
-
int rateDeviceSuitability(VkPhysicalDevice device)¶
Rate the suitability of a Vulkan physical device.
int score = RaeptorCogs::GAPI::Vulkan::rateDeviceSuitability(physicalDevice);
- Parameters:
device – The Vulkan physical device to rate.
- Returns:
int Suitability score of the device.