SpiecsEngine
 
Loading...
Searching...
No Matches

◆ GetAvailableTargetFormats()

ktx_transcode_fmt_e Spices::Transcoder::GetAvailableTargetFormats ( )
staticprivate

Get available gpu compress format.

Returns
Returns available gpu compress format.

Definition at line 239 of file Transcoder.cpp.

240 {
242
243 VkPhysicalDeviceFeatures feature = VulkanDevice::GetDeviceFeatures();
244
245 // Block compression
246 if (feature.textureCompressionBC)
247 {
248 // BC7 is the preferred block compression if available
249 if (FormatSupported(VK_FORMAT_BC7_SRGB_BLOCK))
250 {
251 return KTX_TTF_BC7_RGBA;
252 }
253
254 if (FormatSupported(VK_FORMAT_BC3_SRGB_BLOCK))
255 {
256 return KTX_TTF_BC3_RGBA;
257 }
258 }
259
260 // Adaptive scalable texture compression
261 if (feature.textureCompressionASTC_LDR)
262 {
263 if (FormatSupported(VK_FORMAT_ASTC_4x4_SRGB_BLOCK))
264 {
265 return KTX_TTF_ASTC_4x4_RGBA;
266 }
267 }
268
269 // Ericsson texture compression
270 if (feature.textureCompressionETC2)
271 {
272 if (FormatSupported(VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK))
273 {
274 return KTX_TTF_ETC2_RGBA;
275 }
276 }
277
278 // PowerVR texture compression support needs to be checked via an extension
279 /*if (get_device().is_extension_supported(VK_IMG_FORMAT_PVRTC_EXTENSION_NAME))
280 {
281 if (FormatSupported(VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG))
282 {
283 return KTX_TTF_PVRTC1_4_RGBA;
284 }
285 }*/
286
287 // Always add uncompressed RGBA as a valid target
288 return KTX_TTF_RGBA32;
289 }
#define SPICES_PROFILE_ZONE
static bool FormatSupported(VkFormat format)
Check if the device supports sampling and transfers for the selected image.
static VkPhysicalDeviceFeatures & GetDeviceFeatures()
Get VkPhysicalDeviceFeatures.