ID3DXEffect::Begin method

Starts an active technique.

Syntax

HRESULT Begin(
  [out] UINT  *pPasses,
  [in]  DWORD Flags
);

Parameters

pPasses [out]

Type: UINT*

Pointer to a value returned that indicates the number of passes needed to render the current technique.

Flags [in]

Type: DWORD

DWORD that determines if state modified by an effect is saved and restored. The default value 0 specifies that ID3DXEffect::Begin and ID3DXEffect::End will save and restore all state modified by the effect (including pixel and vertex shader constants). Valid flags can be seen at Effect State Save and Restore Flags.

Return value

Type: HRESULT

If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be one of the following: D3DERR_INVALIDCALL, D3DXERR_INVALIDDATA.

Remarks

An application sets one active technique in the effect system by calling ID3DXEffect::Begin. The effect system responds by capturing all the pipeline state that can be changed by the technique in a state block. An application signals the end of a technique by calling ID3DXEffect::End, which uses the state block to restore the original state. The effect system, therefore, takes care of saving state when a technique becomes active and restoring state when a technique ends. If you choose to disable this save and restore functionality, see D3DXFX_DONOTSAVESAMPLERSTATE.

Within the ID3DXEffect::Begin and ID3DXEffect::End pair, an application uses ID3DXEffect::BeginPass to set the active pass, ID3DXEffect::CommitChanges if any state changes occurred after the pass was activated, and ID3DXEffect::EndPass to end the active pass.

Requirements

Requirement Value
Header
D3DX9Effect.h
Library
D3dx9.lib

See also

ID3DXEffect