Update libktx to 4.4.0

- Use UASTC textures instead of ASTC, transcode to ASTC or BC7 at load time
- Add cmake helpers to generate assets, optimize controller models
- Textures are resized to 512x512 and compressed in UASTC
- Always use libktx
This commit is contained in:
Guillaume Meunier
2025-10-23 21:39:12 +02:00
parent 8854b1b548
commit be6028982e
52 changed files with 668 additions and 627 deletions
+56 -1
View File
@@ -125,7 +125,7 @@ public:
std::tie(resource, allocation) = traits::create(device, create_info, alloc_info);
}
basic_allocation(vk::raii::Device & device, const CreateInfo & create_info, VmaAllocationCreateInfo alloc_info, const std::string & name) :
basic_allocation(vk::raii::Device & device, const CreateInfo & create_info, const VmaAllocationCreateInfo & alloc_info, const std::string & name) :
create_info(create_info)
{
std::tie(resource, allocation) = traits::create(device, create_info, alloc_info);
@@ -139,6 +139,54 @@ public:
});
}
basic_allocation(VmaAllocation allocation, RaiiType && resource) :
allocation(allocation), resource(std::move(resource))
{}
basic_allocation(VmaAllocation allocation, vk::raii::Device & device, RaiiType::CppType resource) :
allocation(allocation), resource(RaiiType{device, resource})
{}
basic_allocation(VmaAllocation allocation, vk::raii::Device & device, RaiiType::CType resource) :
allocation(allocation), resource(RaiiType{device, resource})
{}
basic_allocation(VmaAllocation allocation, vk::raii::Device & device, RaiiType && resource, const std::string & name) :
allocation(allocation), resource(std::move(resource))
{
vmaSetAllocationName(vk_allocator::instance(), allocation, name.c_str());
if (vk_allocator::instance().has_debug_utils)
device.setDebugUtilsObjectNameEXT(vk::DebugUtilsObjectNameInfoEXT{
.objectType = T::objectType,
.objectHandle = uint64_t(CType(*resource)),
.pObjectName = name.c_str(),
});
}
basic_allocation(VmaAllocation allocation, vk::raii::Device & device, RaiiType::CppType resource, const std::string & name) :
allocation(allocation), resource(RaiiType{device, resource})
{
vmaSetAllocationName(vk_allocator::instance(), allocation, name.c_str());
if (vk_allocator::instance().has_debug_utils)
device.setDebugUtilsObjectNameEXT(vk::DebugUtilsObjectNameInfoEXT{
.objectType = T::objectType,
.objectHandle = uint64_t(CType(*resource)),
.pObjectName = name.c_str(),
});
}
basic_allocation(VmaAllocation allocation, vk::raii::Device & device, RaiiType::CType resource, const std::string & name) :
allocation(allocation), resource(RaiiType{device, resource})
{
vmaSetAllocationName(vk_allocator::instance(), allocation, name.c_str());
if (vk_allocator::instance().has_debug_utils)
device.setDebugUtilsObjectNameEXT(vk::DebugUtilsObjectNameInfoEXT{
.objectType = T::objectType,
.objectHandle = uint64_t(resource),
.pObjectName = name.c_str(),
});
}
basic_allocation(const basic_allocation &) = delete;
basic_allocation(basic_allocation && other) :
allocation(other.allocation),
@@ -184,6 +232,13 @@ public:
mapped = nullptr;
}
vk::DeviceSize size() const
{
VmaAllocationInfo info{};
vmaGetAllocationInfo(vk_allocator::instance(), allocation, &info);
return info.size;
}
template <typename U = uint8_t>
U * data()
{