> # NAME

> cgGetDependentProgramArrayStateAssignmentParameter - get one of the parameters that a state assignment's value depends on

> # SYNOPSIS

>       #include <Cg/cg.h>

>       CGparameter cgGetDependentProgramArrayStateAssignmentParameter( CGstateassignment sa,
>                                                                       int index );

> # PARAMETERS

> sa

>   The state assignment handle.

> index

>   The index of the parameter to return.

> # RETURN VALUES

> Returns a handle to the selected dependent parameter on success.

> Returns NULL 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.

> cgGetDependentProgramArrayStateAssignmentParameter returns one of these parameters, as indicated by the given index.

> # 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' */
>       }

> In the above example, assuming select = 0 and stateAssignment is for VertexProgram, the list of parameters returned from cgGetDependentProgramArrayStateAssignmentParameter would be: LightPosition, EyePosition, ModelViewProj, OuterRadius, InnerRadius.

> If stateAssignment was for FragmentProgram, then the list of parameters returned from cgGetDependentProgramArrayStateAssignmentParameter would be: Ambient, DiffuseMaterial, LightColor, SpecularMaterial, LightColor, normalMap, normalizeCube, normalizeCube.

> # ERRORS

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

> CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is less than zero or greater than or equal to the number of dependent parameters, as returned by cgGetNumDependentProgramArrayStateAssignmentParameters.

> # HISTORY

> cgGetDependentProgramArrayStateAssignmentParameter was introduced in Cg 3.0.

> # SEE ALSO

> cgGetNumDependentProgramArrayStateAssignmentParameters