vram_size

Downloadvram_size()   Returns the amount of available video memory in megabytes.

X WARNING: This function can severely interfere with other software requiring texture memory. In some cases, it has be reported, a computer may crash with a BSOD due to apparent memory mismanagement. For these reasons, this function should only be used for debugging purposes and should not be used in released games. See the comments below for more information.

/*
**  Usage:
**      vram_size()
**
**  Arguments:
**      none
**
**  Returns:
**      the amount of available video memory in megabytes
**
**  GMLscripts.com
*/

{
    var s,w,i,m;
    i = 0;
    m = 0;
    for (w=256;w>=1;w=w>>1) {
        for(s[i]=surface_create(w,w);surface_exists(s[i]);s[i]=surface_create(w,w)) {
            m += w*w;
            i += 1;
        }
    }
    for (i-=1;i>=0;i-=1) surface_free(s[i]);
    return (m/262144);
}

Click if you've used this script[Please Login]
Projects: 8

 Contributor: Xemrel

 History:
Mar 17, 2007 - Xemrel submits original script.


comments powered by Disqus