Name
cgGetParameterOrdinalNumber - get a program parameter's ordinal number
Synopsis
#include <Cg/cg.h>
int cgGetParameterOrdinalNumber( CGparameter param );
Parameters
- param
-
The program parameter.
Return Values
Returns the ordinal number associated with a parameter. If the parameter
is a constant
(cgGetParameterVariability returns CG_CONSTANT)
then 0 is returned and no error is generated.
When cgGetParameterOrdinalNumber is passed an array, the ordinal
number of the first array element is returned. When passed a struct,
the ordinal number of first struct data member is returned.
Description
cgGetParameterOrdinalNumber returns an integer
that represents the order in which the parameter was
declared within the Cg program.
Ordinal numbering begins at zero, starting with a program's
first local leaf parameter. The subsequent local leaf parameters
are enumerated in turn, followed by the program's global
leaf parameters.
Examples
The following Cg program:
struct MyStruct { float a; sampler2D b; };
float globalvar1;
float globalvar2
float4 main(float2 position : POSITION,
float4 color : COLOR,
uniform MyStruct mystruct,
float2 texCoord : TEXCOORD0) : COLOR
{
/* etc ... */
}
Would result in the following parameter ordinal numbering:
position -> 0
color -> 1
mystruct.a -> 2
mystruct.b -> 3
texCoord -> 4
globalvar1 -> 5
globalvar2 -> 6
Errors
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
History
cgGetParameterOrdinalNumber was introduced in Cg 1.1.
See Also
cgGetParameterVariability
|