Name
cgSetCompilerIncludeCallback - set the include callback function
Synopsis
#include <Cg/cg.h>
typedef void (*CGIncludeCallbackFunc)( CGcontext context, const char *filename );
void cgSetCompilerIncludeCallback( CGcontext context, CGIncludeCallbackFunc func );
Parameters
- context
-
The context for which the include callback will be used.
- func
-
A pointer to the include callback function.
Return Values
None.
Description
cgSetCompilerIncludeCallback sets a callback function used for handing include statements.
Each Cg runtime context maintains a virtual file system of shader source code for inclusion by the compiler.
Source code is populated into the virtual filesystem using cgSetCompilerIncludeString and cgSetCompilerIncludeFile.
When the compiler encounters an include, firstly the virtual file system is searched for a match.
Secondly the include callback function is called, providing an opportunity for populating shader source via cgSetCompilerIncludeString and cgSetCompilerIncludeFile.
The callback function is passed the context and the requested name.
Thirdly, the filesystem is searched in the usual manner.
Fourthly, an error is raised by the compiler that the include can not be satisfied.
NULL is passed to cgSetCompilerIncludeCallback to disable the callback.
Examples
Errors
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
History
cgSetCompilerIncludeCallback was introduced in Cg 2.1.
See Also
cgGetCompilerIncludeCallback,
cgSetCompilerIncludeString,
cgSetCompilerIncludeFile
|