# Shader errors not being written

## Recommended Posts

Blackhole12    122
    ID3DXBuffer *pBuffer = NULL;
_pengine = pengine;

if(FAILED(D3DXCreateEffectFromFile(_pengine->getDriver()->getDevice(), "bloom.fx", NULL, NULL,
D3DXFX_NOT_CLONEABLE || D3DXSHADER_DEBUG, NULL, &effect, &pBuffer)));
_pengine->ManualErr("The effect 'bloom.fx' failed to compile with the following errors: ",
(char*)pBuffer->GetBufferPointer(),2);
That code compiles and runs fine in Debug mode, but in Release mode, the bloom.fx file fails to compile. However, mysteriously enough, the *pBuffer pointer gets set to NULL after D3DXCreateEffectFromFile() has been called, which results in a null reference error when the error output is accessed. This is, to say the least, incredibly annoying. I have deliberately created a syntax error in the FX file and confirmed that the pBuffer functions normally while in Debug mode. In release mode, however, it just doesn't work. I can't figure out what in the world is wrong with the FX file and I can't figure out why the heck the pBuffer would get set to NULL after D3DXCreateEffectFromFile() gets called. Does anyone here have a clue as to why this would happen?

##### Share on other sites
janta    345
It just can't find the .fx file...?

##### Share on other sites
Blackhole12    122
...Yes, I went back and checked. I had stuck the .fx file in the debug folder and not the release folder.

The most confusing errors are always the stupidest ones...

##### Share on other sites
Saranya    116
Hi,
I faced the same problem.

Have you tried using PIX? I used to get D3DERR_INVALIDCALL.. In that case, try giving the COMPLETE path of the file bloom.fx. Mine worked when I did that.

hth,
Saranya

##### Share on other sites
jollyjeffers    1570
The debug runtimes will output that 'file not found' error message and any compile errors. Yes, best to catch it in-code and output it yourself but just in case you can't/forget there is another way [wink]

hth
Jack