Skip to content

Commit

Permalink
Read image format from ktx instead of hard coding it
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaWillems committed Oct 30, 2024
1 parent 5d89216 commit 7aaf42f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions base/VulkanglTFModel.cpp
Original file line number Diff line number Diff line change
@@ -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)
*/
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7aaf42f

Please sign in to comment.