You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating gli::texture2d or gli::texture_cube directly from gli::load triggers assertion(debug build) or gives undefined behaviour(usually this results to a Vulkan error) in the constructor when failed to load a texture file.
(It does not create empty gli texture)
Here is an example when failed to load a texture.
Fatal : VkResult is "-2" in /mnt/data/work/Vulkan-glTF-PBR/base/VulkanglTFModel.hpp at line 184
Vulkan-glTF-PBR: /mnt/data/work/Vulkan-glTF-PBR/base/VulkanglTFModel.hpp:184: void vkglTF::Texture::fromglTfImage(tinygltf::Image&, vkglTF::TextureSampler, vks::VulkanDevice*, VkQueue): Assertion `res == VK_SUCCESS' failed.
Aborted (core dumped)
Tthis is an issue of gli, so it should be fixed in gli library. For a while, we can use the following workaround:
gli::texture tex(gli::load(filename.c_str());
// will create empty texture when failed to load a texture.
if (!tex.empty()) {
// trigger assertion or return false
}
gli::texture2d tex2D(tex);
...
As with my Vulkan samples, I'll replace gli with libktx. This gives more control over how to handle texture loading failures.
What would be your favorite way of handling texture loading failures? Right now the ktx loading will also just assert, and I think showing some kind of message or gracefully exiting with a proper output would be sufficient.
What would be your favorite way of handling texture loading failures?
Less assertion as much as possible(so we may better to check if a texture file exists before libktx API call). Simply print an error when failed to load a texture(and/or file not found), then exit an app is appreciated.
https://github.com/SaschaWillems/Vulkan-glTF-PBR/blob/master/base/VulkanTexture.hpp#L89
Creating
gli::texture2d
orgli::texture_cube
directly fromgli::load
triggers assertion(debug build) or gives undefined behaviour(usually this results to a Vulkan error) in the constructor when failed to load a texture file.(It does not create empty gli texture)
Here is an example when failed to load a texture.
Tthis is an issue of gli, so it should be fixed in gli library. For a while, we can use the following workaround:
Related to: https://github.com/g-truc/gli/issues/174
The text was updated successfully, but these errors were encountered: