cgSetSamplerStateAssignment
Keywords: cgSetSamplerStateAssignment, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## Name

> cgSetSamplerStateAssignment - sets a state assignment to a sampler effect parameter.

> ## Synopsis

>     #include <Cg/cg.h>

>     CGbool cgSetSamplerStateAssignment( CGstateassignment sa,
>                                         CGparameter param );

> ## Parameters

> sa
>   A state assignment of a sampler type (one of CG_SAMPLER1D, CG_SAMPLER2D, CG_SAMPLER3D, CG_SAMPLERCUBE, or CG_SAMPLERRECT).
> param
>   An effect parameter of a sampler type.

> ## Return Values

> Returns CG_TRUE if it succeeds in setting the state assignment.

> Returns CG_FALSE otherwise.

> ## Description

> cgSetSamplerStateAssignment sets a state assignment of a sampler type to an effect parameter of the same sampler type.

> ## Examples

>     CGparameter effectParam = cgCreateEffectParameter(effect,
>                                                       "normalizeCube",
>                                                       CG_SAMPLERCUBE);
>     CGstate state = cgGetNamedSamplerState(context, "TextureCubeMap");
>     CGstateassignment sa = cgCreateStateAssignment(technique, state);
>     CGbool ok = cgSetSamplerStateAssignment(sa, effectParam);

> ## Errors

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

> CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a sampler type.

> CG_ARRAY_SIZE_MISMATCH_ERROR is generated if sa is an array and not a scalar.

> CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.

> ## History

> cgSetSamplerStateAssignment was introduced in Cg 1.5.

> ## See Also

> cgGetSamplerStateAssignmentValue, cgSetTextureStateAssignment, cgSetBoolArrayStateAssignment, cgSetBoolStateAssignment, cgSetFloatArrayStateAssignment, cgSetFloatStateAssignment, cgSetIntArrayStateAssignment, cgSetIntStateAssignment, cgSetProgramStateAssignment, cgSetStringStateAssignment