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

> ## Name

> cgGetParameterDefaultValue - get the default values of any numeric parameter

> ## Synopsis

>     #include <Cg/cg.h>

>     /* TYPE is int, float, or double */

>     int cgGetParameterDefaultValue{ifd}{rc}( CGparameter param,
>                                              int nelements,
>                                              TYPE * v );

> ## Parameters

> param
>   The program parameter whose default values will be retrieved.
> nelements
>   The number of elements in array v.
> v
>   Destination buffer to which the parameter default values will be written.

> ## Return Values

> Returns the total number of default values written to v.

> ## Description

> The cgGetParameterDefaultValue functions allow the application to get the default values from any numeric parameter or parameter array. The default values are returned in v.

> The given parameter must be a scalar, vector, matrix, or a (possibly multidimensional) array of scalars, vectors, or matrices.

> There are versions of each function that return int, float or double values signified by i, f or d in the function name.

> There are versions of each function that will cause any matrices referenced by param to be copied in either row-major or column-major order, as signified by the r or c in the function name.

> For example, cgGetParameterDefaultValueic retrieves the default values of the given parameter using the supplied array of integer data, and copies matrix data in column-major order.

> The size of v is passed as nelements. If v is smaller than the total number of default values in the given source parameter, CG_NOT_ENOUGH_DATA_ERROR is generated.

> The total number of default values in a parameter, ntotal, may be computed as follow:

>     int nrows = cgGetParameterRows(param);
>     int ncols = cgGetParameterColumns(param);
>     int asize = cgGetArrayTotalSize(param);
>     int ntotal = nrows*ncols;
>     if (asize > 0) ntotal *= asize;

> ## Examples

> to-be-written

> ## Errors

> CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.

> CG_INVALID_POINTER_ERROR is generated if v is NULL.

> CG_NOT_ENOUGH_DATA_ERROR is generated if nelements is less than the total size of param.

> CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.

> ## History

> The cgGetParameterDefaultValue functions were introduced in Cg 2.1.

> ## See Also

> cgGetParameterRows, cgGetParameterColumns, cgGetArrayTotalSize, cgGetParameterValue, cgSetParameterValue, cgGetParameterDefaultValuedc, cgGetParameterDefaultValuedr, cgGetParameterDefaultValuefc, cgGetParameterDefaultValuefr, cgGetParameterDefaultValueic, cgGetParameterDefaultValueir