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

> ## Name

> cgD3D9EnableParameterShadowing - enable or disable parameter shadowing for a program

> ## Synopsis

>     #include <Cg/cgD3D9.h>

>     HRESULT cgD3D9EnableParameterShadowing( CGprogram program,
>                                             CGbool enable );

> ## Parameters

> program
>   The program in which to set the parameter shadowing state.
> enable
>   A boolean switch which controls parameter shadowing for program.

> ## Return Values

> Returns D3D_OK if the function succeeds.

> Returns the D3D failure code if the function fails due to a D3D call.

> ## Description

> cgD3D9EnableParameterShadowing enables or disables parameter shadowing for a program.

> If parameter shadowing is enabled for a program, any call to set the value of a parameter for that program does not set any D3D state. Instead it merely shadows the value so it can be set during a subsequent call to cgD3D9BindProgram.

> If parameter shadowing is disabled, these calls immediately sets the D3D state and do not shadow the value.

> When using this call to disable parameter shadowing, all shadowed parameters for that program are immediately invalidated. No D3D calls are made, so any active program retains its current D3D state. However, subsequent calls to cgD3D9BindProgram for that program will not apply any shadowed state. Parameter shadowing for the program will continue to be disabled until explicitly enabled with another call to cgD3D9EnableParameterShadowing.

> Parameter shadowing can also be specified during a call to cgD3D9LoadProgram.

> ## Examples

>     // prog is a CGprogram initialized elsewhere
>     ...
>     HRESULT hres = cgD3D9EnableParameterShadowing(prog, CG_FALSE);

> ## Errors

> cgD3D9Failed is generated if a D3D function returns an error.

> CGD3D9ERR_NOTLOADED is returned if program was not loaded with the cgD3D9LoadProgram.

> ## History

> cgD3D9EnableParameterShadowing was introduced in Cg 1.1.

> ## See Also

> cgD3D9IsParameterShadowingEnabled, cgD3D9LoadProgram