vblanco20-1 / vkguide-comments

Storage for the comments of vulkan-guide
0 stars 0 forks source link

Asset System Comments #13

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Implementing an asset system. - Vulkan Guide

Practical guide to vulkan graphics programming

https://www.vkguide.dev/docs/extra-chapter/asset_system/

paridas0813 commented 2 years ago

thanks, a perfect tutorial , but it the asset which are "TopDownScifi Sponza2 polycity" seems lost, please upload it!!!!

Lucodivo commented 2 years ago

In my asset system, I tried decompressing the binary blob directly to a mapped VMA staging buffer. Performance was poor as my VMA staging buffer was not HOST_CACHED and the LZ4 decompression algorithm was performing multiple reads from the uncached memory. In my instance, the virtual memory pages allocated were marked as write-combine. This is a memory typed used to optimize writes in a way that reduces PCIe overhead and pollution of the cache, but comes at the cost of very slow, uncached reads. I know of two fairly easy solutions:

1) Avoid reads all together on the VMA staging buffer. Just decompress to a separate buffer (std::vector or just an array) and then memcpy to the mapped VMA allocation to avoid reads on that memory type. [a staging buffer for a staging buffer 😅] 2) Keep the reads by continuing to decompress directly to the mapped VMA staging buffer. However, make sure that the staging buffer was creating using the VK_MEMORY_PROPERTY_HOST_CACHED_BIT flag set in either VmaAllocationCreateInfo.requiredFlags or VmaAllocationCreateInfo.preferredFlags.

On my computer, decompressing "lost_empire-RGBA.tx" directly to the uncached staging buffer took ~3s. Decompressing to a separate buffer followed by a memcpy to the uncached buffer took ~95ms. And decompressing directly to a cached staging buffer took ~75ms.

iaomw commented 1 year ago

Why does it trying to install nvtt to my /usr/local/share/doc/nvtt folder?

alexpanter commented 1 year ago

std::filesystem was modelled in partial after boost::filesystem, so that library would be a good alternative for pre-C++17 projects.