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 Classic Chat / Error: Ran out of GPU memory

Author
Message
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 28th Sep 2018 22:46
I'm doing a VR slideshow, with about 80MB of graphic, but now it gave me this error:

Quote: "Error: Ran out of GPU memory, try using smaller or fewer images in main.agc at line 557"


That line 557 is the sync() command.

Is there a way to figure out what exactly is causing the memory drain?
puzzler2018
User Banned
Posted: 29th Sep 2018 09:44
wow 80mb of graphic

- Is it just one gaaphic

- Is/Are they PNG at all

- Whats the height/width of them

- Are you deleting the images when not required

- Are you creating many objects for the images to be applied to - if so, how many would you say your creating?


If you loading say hunreds of images in once go and then this may cause issue

1 PNG memory consumption is width * height * 4
-
So if we say each is 1024 x 1024 x 4 = 4194304 bytes = 4mb

so if you have 80mb of graphic - you could say * this by 4 for memory consmption


Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 29th Sep 2018 12:27
There are a few good commands for this

GetImageMemoryUsage() - To see how much memory your using for images
GetLoadedImages() - Check to see if you are continually loading more images
GetUnassignedImages() - Very useful to see if you arent deleting images when finished with them
GetUnassignedImageFileName() - used to find the filenames of any images you havent deleted above

80Mb isnt much really...if your running out then its likely your using a LOT more than that really.

Check and double check you are releasing (deleting) images that are no longer used. Use ResizeImage to lower memory usage where possible too.
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 29th Sep 2018 13:19 Edited at: 29th Sep 2018 13:19
Thanks, I think I'm getting closer here!

Okay, I have 80 .JPG images, each somewhere about 1768x1795 pixels. Their compression is pretty extreme, so it would likely take up a lot of memory.

I have a type that holds the images:



at each render, imgLeftID and imgRightID are displayed to the left and right eye, using a plane object.

GetImageMemoryUsage() gave me 1478.062988
I guess that means I'm using 1478 MB of GPU memory?

When I looked into the help for GetImageMemoryUsage(), it said that "Every image you load will be placed in GPU memory, even if you don't use it,"

It's a slideshow, so I thought it would be most reasonable to load them all into memory at one go. But maybe it would be smarter to load/delete the images during the slideshow?
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 29th Sep 2018 14:00
Yeah...your using 1.4gb of memory and so you are genuinely running out of memory having so much data loaded at once. Thats a lot of memory to be using just for images.

Each 1768x1795 image takes up 12.1Mb by itself. All images in AppGameKit are stored un compressed (4 bytes per pixel)

Id consider dynamically loading them like you said, or reduce the resolution.

You could always have the current slide loaded as well as the one to the left and right. So 3 images are loaded at once. That way the move to the next image is instant, no loading time. You then have to load the next image and delete the previous one after a slide is changed. That way the load times are much less percievable to a user. Plus the app startup would be a lot quicker that way too.
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 29th Sep 2018 15:03
Quote: "You could always have the current slide loaded as well as the one to the left and right. So 3 images are loaded at once. That way the move to the next image is instant, no loading time. You then have to load the next image and delete the previous one after a slide is changed."


Hey, that's kinda what I did back when making websites for the internet was a big thing! I was considering this myself a minute ago. But I don't think this is going to work here. Even if the user spends 12 seconds looking at the current slide, I still have to load the image at one go, between two screen updates. So I can't use those 12 secs to progressively load the images.
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 1st Oct 2018 16:23
I have now made each photo slide load from the harddrive the moment it is displayed. But, there is a slight delay! Is it possible to load an image gradually in the background, so the program doesn't have to pause until the image has loaded...?
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Oct 2018 19:53
I believe you'd need multi-threading to load in the background like that. Could probably swing that in Tier 2.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 2nd Oct 2018 09:28
Why can't you do it like Bengismo said and load a handful of images at the start and then load only a few images at a time based on the direction the user is flowing through the image? Or is the next image not known until the user selects it?

You could also try pre-converting to memblocks, they'll load much faster.
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 2nd Oct 2018 10:56
Not sure what your doing , but you got a 1768x1795 image size and are displaying 2 images on screen.

So if this is for a desktop app you can just reduce the image size to 960x? , This will still give you the same quality as resolution will normally be 1920x1080 , so you still get the pixel to pixel resolution, without AppGameKit having to reduce the size of your images, and your going to more then half the mem usage, it will get you below 1gb and everything should run fine.

If this is for 4k then well, it will not work
Subscribe and checkout great AppGameKit video's here: Videos click here
Latest GameGuru Loader news: News click here
Get GameGuru Loader PBR version here: Steam click here
best regards Preben Eriksen,
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 2nd Oct 2018 11:43
I should have said this more loudly (sorry) but the slideshow is in VR! This makes things a little bothersome. The issue isn't with the slides refreshing, but the refresh of the users view. VR runs at 90 fps, and if the game halts while loading a slide, the users view of the VR world freezes, which is quite unpleasant.

Not really sure what would be the optimal image size here, with all kind of different VR devices and new ones coming.

But I could make the view go black between slide update, so if it freezes, it just goes dark instead of stuttering. yeah, that could work!

Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 2nd Oct 2018 12:17
Just checked the Vive Pro it has a 2,880 x 1,600 resolution.

So you could resize your images to 1440x without loosing any quality , perhaps you then get below 1 gb GPU mem.
You can then just load all your images in one go then, without running out of GPU mem

Just remembered, make sure you use "SetGenerateMipmaps(0)" or your images will take up way more mem.


Subscribe and checkout great AppGameKit video's here: Videos click here
Latest GameGuru Loader news: News click here
Get GameGuru Loader PBR version here: Steam click here
best regards Preben Eriksen,
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 2nd Oct 2018 13:47
I think, Preben, the issue with VR is perhaps that the user can move closer?

Anywya, as was mentioned, memblocks load faster but will hammer the disk space as they aren't compressed. You can stream them, but that wont work well because of both size and the time it would take.

Could you perhaps load thumbnails of all the images, the load a single larger one if the user focusses on it?
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 3rd Oct 2018 23:43
One thing I consider is to load the left eye image, the right eye image and the stereoview display image one at a time, and then display them. But the downside would be that if it still gives stuttering, it will be more noticeable since it spread over a longer time. I could try downscaling the images and see if it is any loss.

This project has now gone from "practically abandoned" to something I'm working on. You guys are really great!

Login to post a reply

Server time is: 2024-11-23 16:19:23
Your offset time is: 2024-11-23 16:19:23