Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / error: vkCreateBuffer error: -2 ??

Author
Message
dandrews
3
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 28th Oct 2021 05:49
im getting an error message, Error: vkCreateBuffer error:-2 in main.agc at line 844, when hitting play to test my game and im not sure what it means.....
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 28th Oct 2021 09:02
Assuming it's just reporting the Vulkan Error directly from vkCreateBuffer., this error is most likely "Out of Device Memory" (i.e. Graphics Memory)
How much Graphics Memory do you have., and what sort of size are the images you're trying to load?
Pfaber1
6
Years of Service
Recently Online
Joined: 7th Jan 2018
Location: England
Posted: 28th Oct 2021 10:03
Rebooting your computer might help. I've had this happen a few times and after fitting some extra ram have not had a problem . Not saying it would help but it might . I have integrated graphics and it does have 128mb of dedicated ram . Not very much I know but the ram boost significantly helped.
dandrews
3
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 28th Oct 2021 14:13
Quote: "Assuming it's just reporting the Vulkan Error directly from vkCreateBuffer., this error is most likely "Out of Device Memory" (i.e. Graphics Memory)
How much Graphics Memory do you have., and what sort of size are the images you're trying to load?
"

each image is about 415 kb i can make them smaller and was planning to but just procrastinating. is it better to maybe have a loading function to load everything i need in the beginning ie a loading screen or to keep it all in the setup?
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 29th Oct 2021 01:34
415kB x 8 Images isn't a massive amount of Memory (3.24MB)
So I'd assume you have a few more images being loaded.

Now as to how to approach Loading these Images... well because of AGK's Memory Management (or lack thereof)., while you do want to load them during a Loading Screen; you want to ONLY load specifically what will be used in a given Level.

Also AppGameKit doesn't use Image Compression., just doesn't support it (or well it does but it's disabled, like a lot of other clearly planned but never implemented features; like Cube Maps, Volume Maps, Custom MipMaps, etc.)
So your images will take up a RAW Space... this is a simple look-up table of common image sizes.

2048x2048 (16.4 MB)
1024x1024 (4.1 MB)
512x512 (1.0 MB)
256x256 (256 kB)
128x128 (64 kB)

Notice how doubling the resolution, quadruples the memory space... now what I find strange about AppGameKit is given the focus on Mobile Development and specifically supporting "Less Capable" (i.e. Low-End / Legacy) Handsets; that more effort wasn't put into supporting 8bit (256 Colours) and 16bit (65535 Colours) RGBA Values., as these do dramatically reduce the memory footprint by a Factor of 4 and 2 (respectively).
512x512 32bit (1.0MB)
512x512 16bit (512kB)
512x512 8bit (256kB)

But then the same is true with Hardware Colour Compression., such-as Binary Compression (aka BCn).
As you can get 32bit Colour Depth; at (up to) 25% the Memory Footprint...
512x512 32bit RAW (1.0MB)
512x512 32bit BC7 (256kB)

And while the trade off used to be noticeable colour shifting, banding and artefacts... today most Texture Compression Tools., provide a near 1:1 with the original; meaning you're just getting a smaller memory footprint.

As noted., it's strange that this wasn't considered a priority to support; and still isn't supported.
Where-as if you were to use Dark BASIC Professional with DDS Images., well this is 100% supported... just a shame DBP doesn't support Mobiles (Android / iOS / Windows Mobile)

So yeah, all you can really do is use smaller resolution images.
The other thing you can do is ensure that Auto-Generated MipMapping is disabled., as keep in mind this creates up to 7 Levels of Smaller Images; which is useful to reduce Memory and Processing Overhead for "Distance" Textures in 3D Games... as it would swap out a smaller image at a greater distance.
But while each level is Divided by 2 of the Previous Level

(i.e. 1024 > 512 > 256 > 128 > 64 > 32 > 16 > 8) each of those levels also uses extra memory space., so unless you NEED it... it's best to ensure it's disabled.
As instead of using 4.1MB (for the example above) you'd end up using ~5.5MB instead.
So can lead to some "Hidden" Extra memory Cost for your Images.
dandrews
3
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 29th Oct 2021 04:41
thank you for the information. i thought that i had to load in setup every image, sound, video ect.... that i would be using in the game from what i gather here thats not the case.. so instead say i have to load all these cars

i should take this out of the setup and put it in a function to load these only when i need them??
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 3rd Nov 2021 18:33
Quote: "i should take this out of the setup and put it in a function to load these only when i need them??"


Everything in the whole game should be this way.

Like your menu, you use it , save the info then delete it all to load into game.

Your game is the same way, If you are not rendering it then try not to have any images loaded for nothing.

The nice thing about App Game Kit is you can load and delete in game play if you do it correctly.

Also use a lot of atlas textures or animated sprites and use set sprite frame, like your cars, you could have them all on one sprite sheet, well unless there all animated.

Any icons for game all on one Sprite,

I am telling you everything I learned and am doing lately.

Clone your sprites with clone sprite, do not make sprites over and over, I learned this also uses memory.

Imagine having one sprite loaded then cloning them and there is only one sprite in memory.

Just some pointers.

Login to post a reply

Server time is: 2024-03-28 14:02:18
Your offset time is: 2024-03-28 14:02:18