[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] WebGL API for available memory?
You are correct that it's not part of the OpenGL spec, however there are often ways to query this information. Look at these extensions, for example:
The number reported also doesn't need to be exact since it's only a hint.
On Wed, Mar 6, 2013 at 1:52 PM, Patrick Baggett <email@example.com>
There is no such API to do this from OpenGL / OpenGL ES itself, so it is not possible.
On Wed, Mar 6, 2013 at 3:33 PM, Evan Wallace <firstname.lastname@example.org>
I am interested in building complex WebGL applications that operate on large datasets. One of the main barriers for me is that there is no way to tell how much memory is available on the user's machine. If a WebGL app uses too much memory then it starts thrashing the GPU, which causes lots of lag for the entire OS and is a very bad user experience. I've currently been dealing with it by trying to use as little memory as possible and swapping out memory with the CPU as the computation progresses but it's a shame not to run faster on hardware with more memory.
My second attempt was to slowly allocate more and more memory until a slowdown is detected, but this is undesirable for several reasons. It takes a lot of time to perform which hurts startup time, it's a fragile measurement since lots of other things can also cause similar slowdowns (another app opening, for example), and once the GPU memory limit has been exceeded the lag due to thrashing can be pretty bad (I've observed system-wide graphical pauses lasting around a second) and/or cause other stability problems.
I'm wondering if it would be possible to develop an API to determine the amount of available memory on the GPU, probably as a WebGL extension. Since it provides the relative amount currently left instead of the absolute total amount, it would be both much more useful to WebGL apps and far less useful for fingerprinting. Thoughts?