This topic is 3558 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

This should be simple as simplest it can be, but CreateEffectFromFile always failes. Was now sitting with this more then 2 hours, and I still see no reason why it failes. I have a simple function to load a file from disk:
bool load(LPDIRECT3DDEVICE9 device, wchar_t *path)
{
if(FAILED(D3DXCreateEffectFromFile( device, path, 0, 0, flags, 0, &fx, 0))){
dxlExitError(L"Cannot Create Effect From File");
return false;
}

fx->FindNextValidTechnique(0,&techniq);
if(!techniq)
return false;
// prepare for rendering
if(FAILED(fx->SetTechnique(techniq)))
return false;

fx->Begin(&passes,0);
return true;
}
It is called like this:
void init(LPDIRECT3DDEVICE9 device)
{

device->SetRenderState(D3DRS_ZENABLE,  TRUE ); // Z-Buffer (Depth Buffer)
device->SetRenderState(D3DRS_CULLMODE, FALSE); // Disable Backface Culling
device->SetRenderState(D3DRS_LIGHTING, FALSE); // Disable Light
device->SetRenderState( D3DRS_AMBIENT, 0xffffffff );

cam.setPosition(D3DXVECTOR3(0,20,-20));
}
And it always failes in D3DXCreateEffectFromFile :-(. I am trying to use simplest possible shader (just spotting out a green pixel):
float4 green() : COLOR
{
return {0.0f, 1.0f, 0.0f, 1.0f};
}

technique exc1
{
pass p0
{
}
}

Should I do some other special preparation or something? I have tryed different flags in call to D3DXCreateEffectFromFile, tryed putting 1.fx in different places (but it is red only from same folder where project files are), I have tryed with "./" prefix, with absolute path and I don't know what else. Any tips on what might be wrong? ______________________________________ Can be the case that FXComposer spitts out ASCII files instead of unicode? According to docs, if unicode path is passed to D3DXCreateEffectFromFile it will threat the file as a unicode file, and if ascii path is passed, then file will be parsed as an ascii file?

Share on other sites
You can get the error message from the shader creation.

Note that I'm using multibyte...

LPD3DXEFFECT nEff = NULL;LPD3DXBUFFER pErr = NULL;	#if defined(DEBUG) || defined(_DEBUG)	static const DWORD shaderSettings = D3DXSHADER_DEBUG | D3DXSHADER_SKIPVALIDATION |D3DXSHADER_OPTIMIZATION_LEVEL3 | D3DXSHADER_PARTIALPRECISION;#else 	static const DWORD shaderSettings = D3DXSHADER_SKIPVALIDATION |D3DXSHADER_OPTIMIZATION_LEVEL3 | D3DXSHADER_PARTIALPRECISION;	#endif D3DXCreateEffectFromFile(p3dDev, file,0,0,shaderSettings,0,&nEff,&pErr);if( !nEff ){	if( pErr )	{		MessageBox(settings.hWnd, (char*)pErr->GetBufferPointer(), "Error while compiling shader",MB_OK);		pErr->Release();		pErr = 0;	}				return false;}

Share on other sites
Hej Thnks, that helped :-) ... yipieee

I got error that pixel shader 1.1 is no longer suppoerted??????? Albeit FXComposer was just fine with ps_1_1 on same machine :-).

error X3539: ps_1_x is no longer supported; use /Gec in fxc to automatically upgrade to ps_2_0error X3539: Alternately, fxc's /LD option allows use of the old compiler DLL

Share on other sites
Since October 2006 the default compiler is the SM4/D3D10 one. The back-end technology used for this incarnation made it difficult to support the incredibly tight constraints of SM1 profiles hence them no longer being supported.

Use D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY or D3DXSHADER_USE_LEGACY_D3DX9_31_DLL to avoid this error. The first is simplest but imposes a minimum of SM2 hardware (GeForceFX or Radeon 9500 and later) and the latter allows for actual SM1 but takes out an additional dependency you must handle with your installer.

The last time I looked at FXComposer it used a very old version of the DXSDK. If that's still the case it'd explain why it still works for SM1 profiles.

hth
Jack

Share on other sites
That's probably true, I was using fxcomposer 1.8.

I don't know if it is still possible to use 1.xx profiles in fxcomposer 2.0, I haven't tryed it yet.