NAME

cgCompileProgram, cgIsProgramCompiled - compile a program object

SYNOPSIS

  #include <Cg/cg.h>

  void cgCompileProgram( CGprogram prog );

  CGbool cgIsProgramCompiled( CGprogram prog );

PARAMETERS

prog

Specifies the program object to compile or inspect.

DESCRIPTION

cgCompileProgram compiles the specified Cg program for its target profile. A program must be compiled before it can be loaded (by the API-specific part of the runtime). It must also be compiled before its parameters can be inspected.

Certain actions invalidate a compiled program and the current value of all of its parameters. If one of these actions is performed, the program must be recompiled before it can be used. A program is invalidated if the program source is modified, if the compile arguments are modified, or if the entry point is changed.

If one of the parameter bindings for a program is changed, that action invalidates the compiled program, but does not invalidate the current value of the program's parameters.

cgIsProgramCompiled is used to determine whether a compile is necessary.

RETURN VALUES

cgIsProgramCompiled returns CG_FALSE if the program has never been compiled, or when the compiled program becomes invalid.

EXAMPLES

  if( ! cgIsProgramCompiled( prog ) )
      cgCompileProgram( prog );

ASSOCIATED GETS

cgGetProgramString with pname CG_PROGRAM_RESULT.

ERRORS

CG_PROGRAM_HANDLE_ERROR is generated if prog is an invalid program handle.

CG_COMPILE_ERROR is generated if the compile fails.

SEE ALSO

the "cgCreateProgram" document, the "cgGetNextParameter" document, the "cgIsParameter" document, the "cgGetProgramString" document