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

> ## Name

> cgGetNamedParameter - get a program parameter by name

> ## Synopsis

>     #include <Cg/cg.h>

>     CGparameter cgGetNamedParameter( CGprogram program,
>                                      const char * name );

> ## Parameters

> program
>   The program from which to retrieve the parameter.
> name
>   The name of the parameter to retrieve.

> ## Return Values

> Returns the named parameter from the program.

> Returns NULL if the program has no parameter corresponding to name.

> ## Description

> The parameters of a program can be retrieved directly by name using cgGetNamedParameter. The names of the parameters in a program can be discovered by iterating through the program's parameters (see cgGetNextParameter), calling cgGetParameterName for each one in turn.

> The parameter name does not have to be complete name for a leaf node parameter. For example, if you have Cg program with the following parameters :

>     struct FooStruct
>     {
>       float4 A;
>       float4 B;
>     };

>     struct BarStruct
>     {
>       FooStruct Foo[2];
>     };

>     void main(BarStruct Bar[3])
>     {
>       /* ... */
>     }

> The following leaf-node parameters will be generated :

>     Bar[0].Foo[0].A
>     Bar[0].Foo[0].B
>     Bar[0].Foo[1].A
>     Bar[0].Foo[1].B
>     Bar[1].Foo[0].A
>     Bar[1].Foo[0].B
>     Bar[1].Foo[1].A
>     Bar[1].Foo[1].B
>     Bar[2].Foo[0].A
>     Bar[2].Foo[0].B
>     Bar[2].Foo[1].A
>     Bar[2].Foo[1].B

> A handle to any of the non-leaf arrays or structs can be directly obtained by using the appropriate name. The following are a few examples of names valid names that may be used with cgGetNamedParameter given the above Cg program :

>     "Bar"
>     "Bar[1]"
>     "Bar[1].Foo"
>     "Bar[1].Foo[0]"
>     "Bar[1].Foo[0].B"
>     ...

> ## Examples

> to-be-written

> ## Errors

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

> ## History

> cgGetNamedParameter was introduced in Cg 1.1.

> ## See Also

> cgIsParameter, cgGetFirstParameter, cgGetNextParameter, cgGetArrayParameter, cgGetParameterName