   D3DX10CreateEffectFromFile - Get Error Msg
  How do I get the error message from D3DX10CreateEffectFromFile?I tired using the blob. It has an address after I call D3D10CreateBlob, but comes back NULL after the call to D3DX10CreateEffectFromFile. Yet, the creation fails.   LPD3D10BLOB blob = NULL;   D3D10CreateBlob(512, &blob);   if( FAILED(D3DX10CreateEffectFromFile(filePath.c_str(), NULL, NULL, "fx_4_0", effectFlags, D3D10_EFFECT_COMPILE_CHILD_EFFECT, &m_device, &effectPool, NULL, &m_effect, &blob, NULL)) )   { char * compileErrors = static_cast<char *>(blob->GetBufferPointer());  std::stringstream msg; msg << "Could not compile effect file: " << filePath << " "; msg << compileErrors; exception.m_msg  = msg.str();  blob->Release(); throw exception;   }
  My guess is the file isn't being found. You can use DXGetErrorString() and DXGetErrorDescription to figure out what's going on. You just feed them your HRESULT and they return the error code and a description:HRESULT hr = D3DX10CreateEffectFromFile(...);...const WCHAR* errorString = DXGetErrorString(hr);;Quote:Original post by AristeMy guess is the file isn't being found. You can use DXGetErrorString() and DXGetErrorDescription to figure out what's going on. You just feed them your HRESULT and they return the error code and a description:HRESULT hr = D3DX10CreateEffectFromFile(...);...const WCHAR* errorString = DXGetErrorString(hr);DXGetErrorString is returning "E_FAIL"DxGetErrorDescription is returning "An undefined error has occured"Not a very descriptive error message!Path is correct. It succeeded until I added some stuff to the file. It also compiles offline which is strange. I debug and check the full path and it is correct and hasn't changed since it was working...   ;  I know what code I changed in the effect files. Maybe someone can tell me if what I did was illegal. It's very strange that it still compiles in offline mode though.I tried to add default states to the effect pool.Here is my effect pool file://--------------------------------------------------------------------------------------// File: EffectPool.fx//// Contains shared effect variables and functions that remain the same every frame// for all effects.//--------------------------------------------------------------------------------------shared cbuffer Matrices{   matrix view: View;   matrix projection    : Projection;};shared cbuffer Lights{   struct AmbientLight   { float  intensity; float4 color;   }; struct DirectionalLight   { bool   enabled; float3 direction; float4 color;   }; AmbientLightambientLight;   DirectionalLight directionalLights[8];};BlendState DefaultBlending{   AlphaToCoverageEnable    = FALSE;   BlendEnable[0] = FALSE;   BlendEnable[1] = FALSE;   BlendEnable[2] = FALSE;   BlendEnable[3] = FALSE;   BlendEnable[4] = FALSE;   BlendEnable[5] = FALSE;   BlendEnable[6] = FALSE;   BlendEnable[7] = FALSE;   SrcBlend  = One;   DestBlend = One;   BlendOp   = Add;   SrcBlendAlpha  = One;   DestBlendAlpha = Zero;   BlendOpAlpha   = Add;   RenderTargetWriteMask[0] = 0x0F;   // D3D10_COLOR_WRITE_ENABLE_ALL   RenderTargetWriteMask[1] = 0x0F;   // D3D10_COLOR_WRITE_ENABLE_ALL   RenderTargetWriteMask[2] = 0x0F;   // D3D10_COLOR_WRITE_ENABLE_ALL   RenderTargetWriteMask[3] = 0x0F;   // D3D10_COLOR_WRITE_ENABLE_ALL   RenderTargetWriteMask[4] = 0x0F;   // D3D10_COLOR_WRITE_ENABLE_ALL   RenderTargetWriteMask[5] = 0x0F;   // D3D10_COLOR_WRITE_ENABLE_ALL   RenderTargetWriteMask[6] = 0x0F;   // D3D10_COLOR_WRITE_ENABLE_ALL   RenderTargetWriteMask[7] = 0x0F;   // D3D10_COLOR_WRITE_ENABLE_ALL};DepthStencilState DefaultDepthStencil{   DepthEnable= TRUE;   DepthWriteMask  = All;   DepthFunc  = Less;   StencilEnable   = FALSE;   StencilReadMask = 0xFF;  // DEFAULT_STENCIL_READ_MASK   StencilWriteMask= 0xFF;  // DEFAULT_STENCIL_WRITE_MASK   FrontFaceStencilFail = Keep;   FrontFaceStencilDepthFail = Keep;   FrontFaceStencilPass = Keep;   FrontFaceStencilFunc = Always;   BackFaceStencilFail  = Keep;   BackFaceStencilDepthFail  = Keep;   BackFaceStencilPass  = Keep;   BackFaceStencilFunc  = Always;};The states at the bottom are what I added. Before I added them the application worked. After I added them, effects that are a child of this pool will not compile in the application, but do compile offline.;  I added "shared" to the default states in the effect pool and it works fine now. Still would be good to know how to use the Blob interface to get error messages. It exists after all.   ;  Not sure why yours doesn't work, but here's what I use:ID3D10Blob* compErrors = NULL;HRESULT hr;hr = D3D10CreateEffectFromFile(...); // use &compErrorsif (FAILED(hr)){   if (compErrors)   { MessageBoxA(0, (char*)compErrors->GetBufferPointer(), 0, 0);   }};Quote:Original post by AristeNot sure why yours doesn't work, but here's what I use:ID3D10Blob* compErrors = NULL;HRESULT hr;hr = D3D10CreateEffectFromFile(...); // use &compErrorsif (FAILED(hr)){   if (compErrors)   { MessageBoxA(0, (char*)compErrors->GetBufferPointer(), 0, 0);   }}I got it now. Copied your code in.It would seem the error of declaring states in an effect pool without the shared keyword is something DirectX doens't know how to report. I tried again while making a more obvious error and the blob came back with contents. I just have to check for a NULL blob and report "unknown error" for that case I guess.Thanks!   