cgD3D9UnloadProgram

> # NAME

> cgD3D9UnloadProgram - destroy D3D shader and disable use of expanded interface routines

> # SYNOPSIS

>       #include <Cg/cgD3D9.h>

>       HRESULT cgD3D9UnloadProgram( CGprogram program );

> # PARAMETERS

> program

>   The program for which to disable expanded interface management. The CGprogram handle is still valid after this call.

> # RETURN VALUES

> Returns D3D_OK if the function succeeds.

> Returns the D3D failure code if the function fails due to a D3D call.

> # DESCRIPTION

> cgD3D9UnloadProgram destroys the D3D shader for a program and disables use of expanded interface routines for that program.

> This call does not destroy the CGprogram itself. It only destroys the resources used by the expanded interface, such as the D3D shader object and any shadowed parameters. Use the core runtime function cgDestroyProgram to free the CGprogram itself. Also note that freeing a CGprogram using the core runtime implicitly calls this routine to avoid resource leaks.

> This call is only necessary if specific lifetime control of expanded interface resources outside the lifetime of their associated CGprogram is desired. For instance, if the expanded interface is no longer used, but the CGprogram handle will still be used.

> # EXAMPLES

>       // prog is a CGprogram initialized elsewhere
>       ...
>       HRESULT hres = cgD3D9UnloadProgram(prog);

> # ERRORS

> cgD3D9Failed is generated if a D3D function returns an error.

> CGD3D9ERR_NOTLOADED is returned if program was not loaded with the cgD3D9LoadProgram.

> CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL. This usually occurs when an expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.

> # HISTORY

> cgD3D9UnloadProgram was introduced in Cg 1.1.

> # SEE ALSO

> cgD3D9UnloadAllPrograms, cgDestroyProgram