Ohhh.... I feel that painBrotSagtMist wrote: ↑Sun Feb 05, 2023 1:37 am The problem purely lies in that i do not know HOW MUCH i can preload.
I was struggling to solve that problem in 2019 viewtopic.php?f=4&t=86986
...aaand there was no solution except "use some predefined limit" like lets say 2GB. Which is bad. Bad bad bad.
One note: what you are looking for is the available VRAM amount, not RAM. Because images (or canvases) stored there. All of my projects with a lot of images uses a lot of VRAM, but only < 1GB RAM usually.
Back in the day I had gpu with 11 GB VRAM, now I have 16, and I can fill it all with generated images or some other sh*t in couple of seconds like it is nothing.
Exactly! That is the proper way!It should run on a 128mb potato. But at the same time uses a 128gb monster to its fullest.
Sometime ago I followed some tutorials for vulkan. One of them: https://vulkan-tutorial.com/
And there are functions to get available VRAM amount, along with some other amounts, like RAM, like memory that can be accessed from cpu and from gpu and some other complicated stuff. And not only "there are", but this is basic need to make anything. You need that before you draw your first triangle. Because to draw something you clearly need some buffers, and how can you create any buffer without firstly check if it will fit in? (sarcasm) But for simplicity that step is omitted in love2d. That is the case well known as happy case programming, like "of course it will fit in". That is reasonable default behavior for game engine, because it protects newcomers from these complicated problems. Imagine if before every love.graphics.newImage() you would need to check available VRAM But not to have that mechanism entirely... That is pain.
There is a lot to be said about "Why do you need that?" "Are you sure you need that?" "Maybe you can optimize something?" But all that is secondary. The main question is "How much memory you have?" So you can juggle your stuff inside that limit.
It is depressing. I was depressed 4 years ago Now in love projects I use "better ask for forgiveness than permission" principle. As a workaround you can allocate VRAM with a step of 256 MB or something reasonable like that, and see when it fails. Do that once, when program starts for the first time on a new device and save it in some file. And after use only ~70% of that amount. Or something like that. That is not ideal, that have some caveats, that is not satisfying at all, but it will work at least somehow.It is really depressing that this testing till it fails, as darkfrei just wrote, is the only solution we can come up with.