cgCombinePrograms(3)

NAME
cgCombinePrograms - combine programs from different domains

SYNOPSIS
  #include <Cg/cg.h>
  CGprogram cgCombinePrograms( int n,
                               const CGprogram * exeList );

PARAMETERS
The number of program objects in exeList. An array of two or more executable programs, each from a different domain.

RETURN VALUES
Returns a handle to the newly created program on success.

Returns NULL if an error occurs.

DESCRIPTION
cgCombinePrograms will take a set of n programs and combine them into a single CGprogram. This allows a single call to BindProgram (instead of a BindProgram for each individual program) and provides optimizations between the combined set of program inputs and outputs.

EXAMPLES
  CGprogram p1 = cgCreateProgram(context, CG_SOURCE, vSrc, vProfile,
                                 vEntryName, NULL);
  CGprogram p2 = cgCreateProgram(context, CG_SOURCE, fSrc, fProfile,
                                 fEntryName, NULL);
  CGprogram programs[] = {p1, p2};
  CGprogram combined = cgCombinePrograms(2, programs);
  cgDestroyProgram(p1);
  cgDestroyProgram(p2);
  cgGLBindProgram(combined); /* Assuming cgGL runtime */
  /* Render... */

ERRORS
CG_INVALID_DIMENSION_ERROR is generated if n less than or equal to 1 or n is greater than 3.

CG_INVALID_PARAMETER_ERROR is generated if exeList is NULL.

CG_INVALID_PROGRAM_HANDLE_ERROR is generated if one of the programs in exeList is invalid.

The errors listed in cgCreateProgram might also be generated.

HISTORY
cgCombinePrograms was introduced in Cg 1.5.

SEE ALSO
cgCombinePrograms2, cgCombinePrograms3, cgCreateProgram, cgGLBindProgram, cgD3D9BindProgram, cgD3D8BindProgram