I don’t know why my Vulkan application is breaking at vkCreateImageView(…) with result vk_error_out_of_device_memory after loading in about 523312 small textures when I have plenty of device memory left (7gb out of 11gb), as reported under task manager’s GPU tab. I assume the task manager is fairly accurate in its measurements as it reported the correct dedicated memory usage similar to what I allocated. I am using the Vulkan Memory Allocator library to manage memory, which allocates 256mb blocks as I upload my textures, and I think the problem isn’t with the library itself as the program is breaking at image view creation and not during memory allocation. Which makes it stranger. Does vulkan have limits for the number of image views? Or does creating image views, samplers, descriptors etc, take up unreported device memory?
I understand I am working with an extraordinary amount of texture data and it is quite certainly the culprit, but I don’t know why. Scenes (~300k textures) using a smaller set of the same dataset works fine. Validation layers do not report anything.
Platform: Latest Vulkan SDK 22.214.171.124, Windows 10, GTX 1080 Ti with 11gb heap memory.
Appreciate your insights on this issue.
after loading in about 523312 small textures
Well there’s your problem: don’t make 5 hundred thousand small textures. Use sprite sheets, array textures, or somesuch other techniques to reduce that number.
Does vulkan have limits for the number of image views?
Implementations may have such limitations. That’s why it’s best not to do degenerate things (like making hundreds of thousands of small textures).
Indeed there may be hidden limits (due to HW limitations, or developer laziness). Also try waiting on large amount of fences (fails for me for 65).
My guess would be that it is limited at 2^16 here on your Implementation.
Yes I tested creating vkCreateImageView with any typical image it fails after about 520k loops. I looked at the spec it didn’t mention any limitations for this function, if anyone at khronos working on the implementation can confirm it is in fact a limit or a bug. I know I can pack my textures in arrays, atlases or image array layers but I want to work with a simple implementation first. Ideally for my city rendering project (with unique data textures generated by an automated process) I want to allocate more then a few million textures up to what the device memory can hold.
I looked at the spec it didn’t mention any limitations for this function, if anyone at khronos working on the implementation can confirm it is in fact a limit or a bug.
The implementation told you that you exhausted device memory resources by returning the appropriate error. There is no limitation in the Vulkan specification that says that the only way you can exhaust device memory resources of some kind is through
vkCreateImageView explicitly allows implementations to fail to create textures due to device memory exhaustion.
As long as the implementation is reporting that error, it’s not a “bug”.
I want to allocate more then a few million textures up to what the device memory can hold.
If you want your program to work, stop trying to break it. Stop assuming that, so long as you stay within the numbers the specification says, you can do anything you want. The Vulkan specification makes no such guarantees; that why those functions report that they can exhaust device memory.
Always, always use as few resources as you can get away with.