A question about the relationship between memory, buffers, and textures in Vulkan.
The slides state that memory allocation is something that happens outside of textures and buffers. You then assign specific memory to a buffer/texture.
This seems to suggest that multiple buffers/textures can be assigned to the same memory. Even more, it suggests that you could do memory casting by assigning two textures to the same memory, so long as the two formats and texture sizes result in the same size of data.
So if I had an application that needed lots of textures of a certain size, even if those textures have different image formats, it would be possible for me to “cast” one memory allocation into another format (and overwrite it with data appropriate to the new format). So memory that was used for an RGBA8 image could be repurposed for an RGBA8UI image.
Even more, would it be possible to allocate a large arena of memory up-front, and then dole bits of it out to different textures/buffers as needed, so I don’t have to go through reallocation at runtime? I didn’t see anything in the functions that bind memory objects to buffers/textures that took a size+byte offset, but that could have been in the “_INFO” object somewhere.
There was a function to compute the size of an allocation for a particular texture, presumably taking into account its format, size, etc. How necessary is that? Is there some guarantee such that I can know, off-line, exactly how many bytes will be needed for a texture of a given size/format, regardless of hardware?