Well, I tryed with D3D10CreateEffectFromMemory also and got an E_FAIL error when I try to create the pool. Is strange but I found this in the D3D10effect.h file from the DirectX SDK November 2007:
//----------------------------------------------------------------------------
// D3D10CreateEffectFromXXXX:
// --------------------------
// Creates an effect from a binary effect or file
//
// Parameters:
//
// [in]
//
// TODO: Unicode support
// TODO: Support for binary (and not just ASCII)
The effect I'm trying to create is "binary", because was offline-precompiled using the FXC.
My pool was compiled ok using the following command line:
fxc /T fx_4_0 /O3 /Zpc /Ges /Fh FXShared.hxx /Vn FXShared FXShared.fxh
And the FXShared.fx code is just:
shared cbuffer cbPerFrame
{
float4 g_lightPos;
float4 g_lightAmbientCol, g_lightDiffCol, g_lightSpecCol;
};
It fails (E_FAIL) when I try to create the fx pool as:
HRESULT hr = ::D3D10CreateEffectPoolFromMemory ( (void*)FXShared,
sizeof(FXShared), 0, m_pD3DDev, &m_sPool.pool );
Is curious too that the debug layer does not emit any information about why that failed. From the docs I can see E_FAIL's description:
E_FAIL
An undetermined error occurred inside the Direct3D subsystem.
Which leads me to think that the D3D10CreateEffectFromMemory are not implemented to read binary offline-compiled shaders yet?
The FXC fails also when I try to compile a child effect to a .hxx file using the /Gch option... and without that the D3D10CreateEffectFromMemory() probably will fail if I use the pool...
I tryed to find some example about all this but seems there are only "load from file" calls in the SDK examples 8(
thx