D3D10CreateEffectFromMemory function (d3d10effect.h)
Creates an ID3D10Effect from a buffer containing a compiled effect.
Syntax
HRESULT D3D10CreateEffectFromMemory(
[in] void *pData,
[in] SIZE_T DataLength,
[in] UINT FXFlags,
[in] ID3D10Device *pDevice,
[in] ID3D10EffectPool *pEffectPool,
[out] ID3D10Effect **ppEffect
);
Parameters
[in] pData
Type: void*
A pointer to a compiled effect.
[in] DataLength
Type: SIZE_T
Length of pData.
[in] FXFlags
Type: UINT
Effect compile options.
[in] pDevice
Type: ID3D10Device*
A pointer to the device (see ID3D10Device Interface).
[in] pEffectPool
Type: ID3D10EffectPool*
Optional. A pointer to a memory space for effect variables that are shared across effects (see ID3D10EffectPool Interface).
[out] ppEffect
Type: ID3D10Effect**
A pointer to an ID3D10Effect Interface which contains the created effect.
Return value
Type: HRESULT
Returns one of the following Direct3D 10 Return Codes.
Remarks
Note
Linking d3d10_1.lib
gives you the implementation in d3d10_1.dll
, which is the Direct3D10.1 programming model implementation. Linking d3d10.lib
gives you the implementation in d3d10.dll
, which is the Direct3D10 programming model implementation.
This method is used to create an ID3D10Effect Interface object from an effect that has been compiled before runtime and loaded into memory. For help precompiling an effect, see Offline Compiling. To load and compile an ASCII .fx file see Compile an Effect (Direct3D 10).
Examples
Compile the effect
fxc.exe /T fx_4_0 /Fo Tutorial03.fxo Tutorial03.fx
Load the compiled effect at runtime.
ifstream is("tutorial03.fxo", ios::binary);
is.seekg(0,ios_base::end);
streampos pos = is.tellg();
is.seekg(0,ios_base::beg);
char * effectBuffer = new char[pos];
is.read(effectBuffer,pos);
hr = D3D10CreateEffectFromMemory((void *)effectBuffer,pos,0,g_pd3dDevice,NULL,&g_pEffect);
Requirements
Requirement | Value |
---|---|
Target Platform | Windows |
Header | d3d10effect.h |
Library | d3d10_1.lib, d3d10.lib |
DLL | d3d10_1.dll, d3d10.dll |