Effect_load - Warning on Compiler Error

Posted By: TechMuc

Effect_load - Warning on Compiler Error - 10/17/12 12:13

Hi,

Is there an easy way to avoid the message box when compiling effects via effect_load?
This is a pretty annoying message box for shader editors..

Or: Is there any way to validate an effect from string / file before loading via effect_load (of course DirectX Functions are also acceptable).

regards,
Timo

PS: My current method is to hook the function call of message box, and avoid the called message box. Though this ofc works, i would like to try to avoid any unnessasary hooking, so therefore it would be cool if you could give me a short D3DX Snippet you currently use to check the effects..
Posted By: jcl

Re: Effect_load - Warning on Compiler Error - 10/18/12 08:39

You can compile the effect for checking if there are syntax errors. Our code looks like this:

Code:
LPD3DXEFFECTCOMPILER pEffectCompiler = NULL;
LPD3DXBUFFER pEffect = NULL;
hr = D3DXCreateEffectCompiler(
	content,len,
	NULL,	// defines
	&includeManager,	// includes
	D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY,
	&pEffectCompiler,NULL);

if(SUCCEEDED(hr))
	hr = pEffectCompiler->CompileEffect(
		D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY,
		&pEffect,NULL);
if(!SUCCEEDED(hr) || !pEffect)
	... // show error box



"content" and "len" are the source code and its size.
Posted By: TechMuc

Re: Effect_load - Warning on Compiler Error - 10/18/12 09:12

thanks a lot for your help. The include Manager is currently not active as includes are not allowed in 3D-Gamestudio FX files. Is that correct?

Thanks again,
regards,
Timo
Posted By: jcl

Re: Effect_load - Warning on Compiler Error - 10/18/12 12:09

The include manager is heavily used by the shaders that come with Gamestudio. It just does not yet load external includes, but will support this in the next update.
© 2024 lite-C Forums