NAME

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

SYNOPSIS

  #include <Cg/cgD3D9.h>

  HRESULT cgD3D9UnloadProgram( CGprogram program );

PARAMETERS

program

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

RETURN VALUES

cgD3D9UnloadProgram returns D3D_OK if the function succeeds.

If the function fails due to a D3D call, that D3D failure code is returned.

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 indirectly calls this routine so that no resource leaks will occur.

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

The following example code illustrates the use of cgD3D9UnloadProgram:

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

ERRORS

CGD3D9ERR_NOTLOADED to-be-written

CGD3D9ERR_NODEVICE to-be-written

HISTORY

cgD3D9UnloadProgram was introduced in Cg to-be-written.

SEE ALSO

cgD3D9UnloadAllPrograms, cgDestroyProgram