NAME
cgGetNamedParameter - get a program parameter by name
SYNOPSIS
#include <Cg/cg.h> CGparameter cgGetNamedParameter( CGprogram prog, const char * name );PARAMETERS
- prog
Specifies the program to retrieve the parameter from.
- name
Specifies the name of the parameter to retrieve.
DESCRIPTION
The parameters of a program can be retrieved directly by name using the cgGetNamedParameter function. 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].BA 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 example Cg program :
"Bar" "Bar[1]" "Bar[1].Foo" "Bar[1].Foo[0]" "Bar[1].Foo[0].B" ...RETURN VALUES
Returns the named parameter from the program. If the program has no parameter corresponding to name, a NULL is returned ( cgIsParameter() returns CG_FALSE for invalid parameters).
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if prog does not refer to a valid program.
SEE ALSO
cgIsParameter, cgGetFirstParameter, cgGetNextParameter, cgGetNextStructParameter, cgGetArrayParameter, cgGetParameterName