> ## Name

> cgGetNumDependentProgramArrayStateAssignmentParameters - get the number of parameters on which a state assignment's value depends

> ## Synopsis

>     #include <Cg/cg.h>

>     int cgGetNumDependentProgramArrayStateAssignmentParameters( CGstateassignment sa );

> ## Parameters

> sa
>   The state assignment handle.

> ## Return Values

> Returns the number of parameters on which sa depends.

> Returns 0 if sa is not a program state assignment or an error occurs.

> ## Description

> State assignments in CgFX files may include references to an array indexed by an effect parameter (or expression) on the right hand side of the state assignment that is used for computing the state assignment's value. Usually this array holds the compile statements of shader programs and by changing the index of the shader array, it's possible to switch to a different program or profile on-the-fly.

> Each compile statement in the array can depend on one or more effect parameters which are passed to the program in its parameter list. It is sometimes necessary for the application to query what those parameters are so values can be properly set to them.

> Before you can query these parameters, you must know how many there are. cgGetNumDependentProgramArrayStateAssignmentParameters will return this number.

> ## Examples

> In CgFX file:

>     vertexshader Torus[4] =
>     {
>       compile vp40   C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
>                                   float2( OuterRadius, InnerRadius ) ),

>       compile vp30   C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
>                                   float2( OuterRadius, InnerRadius ) ),

>       compile arbvp1 C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
>                                   float2( OuterRadius, InnerRadius ) ),

>       compile vp20   C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
>                                   float2( OuterRadius, InnerRadius ) )
>     };

>     pixelshader SpecSurf[4] =
>     {
>       compile fp40   C8E4f_specSurf( Ambient, float4(DiffuseMaterial  * LightColor, 1),
>                                      float4(SpecularMaterial * LightColor, 1),
>                                      normalMap, normalizeCube, normalizeCube ),

>       compile fp30   C8E4f_specSurf( Ambient, float4(DiffuseMaterial  * LightColor, 1),
>                                      float4(SpecularMaterial * LightColor, 1),
>                                      normalMap, normalizeCube, normalizeCube ),

>       compile arbfp1 C8E4f_specSurf( Ambient, float4(DiffuseMaterial  * LightColor, 1),
>                                      float4(SpecularMaterial * LightColor, 1),
>                                      normalMap, normalizeCube, normalizeCube ),

>       compile fp20   C8E4f_specSurf( Ambient, float4(DiffuseMaterial  * LightColor, 1),
>                                      float4(SpecularMaterial * LightColor, 1),
>                                      normalMap, normalizeCube, normalizeCube )
>     };

>     int select = 0;

>     technique bumpdemo
>     {
>         pass
>         {
>             VertexProgram   = (Torus[select]);
>             FragmentProgram = (SpecSurf[select]);
>         }
>     }

> In application:

>     int numParameters = cgGetNumDependentProgramArrayStateAssignmentParameters(stateAssignment);
>     for(int i = 0; i < numParameters; ++i) {
>         CGparameter param = cgGetDependentProgramArrayStateAssignmentParameter(stateAssignment, i);

>         /* Set value for 'param' */
>     }

> For this example when select = 0 cgGetNumDependentProgramArrayStateAssignmentParameters will return 5 for VertexProgram and 8 for FragmentProgram.

> ## Errors

> CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.

> ## History

> cgGetNumDependentProgramArrayStateAssignmentParameters was introduced in Cg 3.0.

> ## See Also

> cgGetDependentProgramArrayStateAssignmentParameter