Name
cgCombinePrograms - combine programs from different domains
Synopsis
#include <Cg/cg.h>
CGprogram cgCombinePrograms( int n,
const CGprogram * exeList );
Parameters
- n
-
The number of program objects in exeList.
- 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,
cgCombinePrograms4,
cgCombinePrograms5,
cgCreateProgram,
cgGLBindProgram,
cgD3D9BindProgram
|