Read image format from ktx instead of hard coding it

This commit is contained in:
Sascha Willems 2024-10-30 21:25:01 +01:00
parent 5d89216db5
commit 7aaf42fcb6
2 changed files with 4 additions and 4 deletions

View file

@ -8,7 +8,8 @@ set(KTX_SOURCES
${KTX_DIR}/lib/checkheader.c
${KTX_DIR}/lib/swap.c
${KTX_DIR}/lib/memstream.c
${KTX_DIR}/lib/filestream.c)
${KTX_DIR}/lib/filestream.c
${KTX_DIR}/lib/vkloader.c)
add_library(base STATIC ${BASE_SRC} ${KTX_SOURCES})
if(WIN32)

View file

@ -1,7 +1,7 @@
/*
* Vulkan glTF model and texture loading class based on tinyglTF (https://github.com/syoyo/tinygltf)
*
* Copyright (C) 2018-2023 by Sascha Willems - www.saschawillems.de
* Copyright (C) 2018-2024 by Sascha Willems - www.saschawillems.de
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/
@ -312,8 +312,7 @@ void vkglTF::Texture::fromglTfImage(tinygltf::Image &gltfimage, std::string path
ktx_uint8_t* ktxTextureData = ktxTexture_GetData(ktxTexture);
ktx_size_t ktxTextureSize = ktxTexture_GetSize(ktxTexture);
// @todo: Use ktxTexture_GetVkFormat(ktxTexture)
format = VK_FORMAT_R8G8B8A8_UNORM;
format = ktxTexture_GetVkFormat(ktxTexture);
// Get device properties for the requested texture format
VkFormatProperties formatProperties;