2#include <vulkan/vulkan_core.h>
47 return VK_FORMAT_R8_SRGB;
51 return VK_FORMAT_R8_UNORM;
60 return VK_FORMAT_R8G8_SRGB;
64 return VK_FORMAT_R8G8_UNORM;
73 return VK_FORMAT_R8G8B8_SRGB;
77 return VK_FORMAT_R8G8B8_UNORM;
87 return VK_FORMAT_R8G8B8A8_SRGB;
91 return VK_FORMAT_R8G8B8A8_UNORM;
100 case 1:
return VK_FORMAT_R16_SFLOAT;
101 case 2:
return VK_FORMAT_R16G16_SFLOAT;
102 case 3:
return VK_FORMAT_R16G16B16_SFLOAT;
104 default:
return VK_FORMAT_R16G16B16A16_SFLOAT;
110 switch (components) {
111 case 1:
return VK_FORMAT_R32_SFLOAT;
112 case 2:
return VK_FORMAT_R32G32_SFLOAT;
113 case 3:
return VK_FORMAT_R32G32B32_SFLOAT;
115 default:
return VK_FORMAT_R32G32B32A32_SFLOAT;
120 return VK_FORMAT_R8G8B8A8_SRGB;
constexpr VkFormat getVkFormat(TextureType type, int bits, int components)
Get the correct VkFormat based on texture type and image properties.
TextureType
Represents the semantic type of a texture, determining its Vulkan format.
@ Lightmap
HDR baked lighting data (SFLOAT format)
@ Emissive
Color data with gamma (SRGB format for 8-bit)
@ BaseColor
Color data with gamma (SRGB format for 8-bit)
@ Unknown
Fallback type, uses SRGB as default.
@ Normal
Linear data for normal maps (UNORM format for 8-bit)
@ MetallicRoughness
Linear data for PBR parameters (UNORM format for 8-bit)
constexpr bool requiresLinearFormat(TextureType type)
Check if a texture type requires linear (non-SRGB) format.