GPU memory is limited -- typically more limited than JS heap sizes, etc. Thing like lots of high resolution images can fill up the memory, and it is a shared resource, so other applications could be using a lot of it up.
In OpenGL, I can query for available memory.
Is there any way in WebGL do the same? How can I tell if I run out? What will happen if I do?
I'm not sure how to manage the experience for WebGL. I can fall back to SVGs or Canvas if necessary, but I don't know when that is necessary.
Actually, you can't query VRAM total and available sizes in OpenGL without vendor extensions. OpenGL and consequently WebGL hide that from your application. More over, WebGL manages your resources for you, uploading them to VRAM when they're needed.
If you try to create too much resources, performance of your application will degrade significantly and there is a possibility of generating of the webglcontextlost
event. Also, Mozilla's WebGL implementation may generate the OUT_OF_MEMORY
error on texImage2D
call (it's mentioned in the "WebGL Insights" book), which, in a way, can be used as a sign of exhausting system resources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With