From 7aaf42fcb6a9a606175fd91c356333f2e54e8bbb Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Wed, 30 Oct 2024 21:25:01 +0100 Subject: [PATCH] Read image format from ktx instead of hard coding it --- base/CMakeLists.txt | 3 ++- base/VulkanglTFModel.cpp | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index c4ccbc011..1f0099e43 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -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) diff --git a/base/VulkanglTFModel.cpp b/base/VulkanglTFModel.cpp index e57d2499e..e6a163a79 100644 --- a/base/VulkanglTFModel.cpp +++ b/base/VulkanglTFModel.cpp @@ -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;