cgGetNamedParameter(3)

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
the cgIsParameter manpage, the cgGetFirstParameter manpage, the cgGetNextParameter manpage, the cgGetNextStructParameter manpage, the cgGetArrayParameter manpage, the cgGetParameterName manpage