surface_get_target_ext

This function retrieves the surface assigned to one of the 4 render targets available to surfaces.

You supply the index of the render target to check, and the function will return -1 if no surface is assigned, or an integer value >= 0, representing the surface assigned (as returned by the functions surface_create / surface_create_ext).

 

Syntax:

surface_get_target_ext(index);

ArgumentTypeDescription
indexRealThe render target index to check (from 0 to 3).

 

Returns:

Surface or -1 (if no target surface is set)

 

Example:

if surface_get_target_ext(0) == -1
{
    surface_set_target_ext(0, global.Surf);
}

The above code first checks if the shader render target 0 has been set to a surface. If not, then one is assigned.