Cg Toolkit Cg 3.1 Toolkit Documentation
Cg / Runtime / CgD3D9 / cgD3D9EnableParameterShadowing

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


Cg Toolkit | Cg Toolkit | Download | Release Archive | Profiles | Reference | Books | Discussions |


Cg Runtime CgD3D9

cgD3D9BindProgram
cgD3D9EnableDebugTracing
cgD3D9EnableParameterShadowing
cgD3D9GetDevice
cgD3D9GetLastError
cgD3D9GetLatestPixelProfile
cgD3D9GetLatestVertexProfile
cgD3D9GetManageTextureParameters
cgD3D9GetOptimalOptions
cgD3D9GetTextureParameter
cgD3D9GetVertexDeclaration
cgD3D9IsParameterShadowingEnabled
cgD3D9IsProfileSupported
cgD3D9IsProgramLoaded
cgD3D9LoadProgram
cgD3D9RegisterStates
cgD3D9ResourceToDeclUsage
cgD3D9SetDevice
cgD3D9SetManageTextureParameters
cgD3D9SetSamplerState
cgD3D9SetTextureParameter
cgD3D9SetTexture
cgD3D9SetTextureWrapMode
cgD3D9SetUniformArray
cgD3D9SetUniformMatrixArray
cgD3D9SetUniformMatrix
cgD3D9SetUniform
cgD3D9TranslateCGerror
cgD3D9TranslateHRESULT
cgD3D9TypeToSize
cgD3D9UnbindProgram
cgD3D9UnloadAllPrograms
cgD3D9UnloadProgram
cgD3D9ValidateVertexDeclaration