cgEvaluateProgram
Keywords: cgEvaluateProgram, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## Name

> cgEvaluateProgram - evaluates a Cg program on the CPU

> ## Synopsis

>     #include <Cg/cg.h>

>     void cgEvaluateProgram( CGprogram program,
>                             float * buf,
>                             int ncomps,
>                             int nx,
>                             int ny,
>                             int nz );

> ## Parameters

> program
>   The program to be evalutated.
> buf
>   Buffer in which to store the results of program evaluation.
> ncomps
>   Number of components to store for each returned program value.
> nx
>   Number of points at which to evaluate the program in the x direction.
> ny
>   Number of points at which to evaluate the program in the y direction.
> nz
>   Number of points at which to evaluate the program in the z direction.

> ## Return Values

> None.

> ## Description

> cgEvaluateProgram evaluates a Cg program at a set of regularly spaced points in one, two, or three dimensions. The program must have been compiled with the CG_PROFILE_GENERIC profile. The value returned from the program via the COLOR semantic is stored in the given buffer for each evaluation point, and any varying parameters to the program with POSITION semantic take on the (x,y,z) position over the range zero to one at which the program is evaluated at each point. The PSIZE semantic can be used to find the spacing between evaluating points.

> The total size of buf should be equal to ncomps*nx*ny*nz.

> ## Examples

> to-be-written

> ## Errors

> CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.

> CG_INVALID_PROFILE_ERROR is generated if program's profile is not CG_PROFILE_GENERIC.

> CG_INVALID_PARAMETER_ERROR is generated if buf is NULL, any of nx, ny, or nz is less than zero, or ncomps is not 0, 1, 2, or 3.

> ## History

> cgEvaluateProgram was introduced in Cg 1.4.

> ## See Also

> cgCreateProgram, cgCreateProgramFromFile, cgCreateProgramFromEffect, cgGetProgramProfile