texture_prefetch

This function can be used to "prefetch" a texture page or a group of texture pages, i.e.: load them into VRAM when required.

You supply the unique texture page ID (as returned by the texturegroup_* functions) to prefetch a single page, or you can supply a texture group name (as defined in the Texture Group Editor) to prefetch all the texture pages in the group.

NOTE There is a performance hit as the texture is uploaded to texture memory on most devices, so it's recommended that you call texture_prefetch on any required graphics at the start of a level to avoid any stalls.

 

Syntax:

texture_prefetch(tex_id);

ArgumentTypeDescription
tex_idTexture or StringThe texture page pointer or a texture group name (a string)

 

Returns:

N/A

 

Example:

var _tex_array = texturegroup_get_textures( "MainMenu");
for (var i = 0; i < array_length(_tex_array); ++i;)
{
    texture_prefetch(_tex_array[i]);
}

The above code will prefetch all the texture pages under the texture group "MainMenu".