D3DXCreateEffectFromFile major bug?

Started by
6 comments, last by Lightness1024 11 years, 2 months ago

On some of my client's PC's, D3DXCreateEffectFromFile fails regardless of the content of the .fx file.

D3DXCreateEffectFromFile returns an undocumented HRESULT value: 0x8007007E

Parameter ppCompilationErrors is NULL so it's not possible to retrieve any further error information.

It fails on some PC's, but on most it's fine!

So, I have a downloaded an .exe of arbitrary tutorial that shows .fx files and supplied that to the client's with the problem, and that works just fine. That was build on a DirectX version from 2006/2007 (d3dx_30.dll). So it's not about shaders not being supported or something!

I then rebuild that tutorial's project on my IDE (DirectX SDK June 2010), supplied the .exe to the client's experiencing this bug and then the function bugs again!

So, then I thought it might be the different DirectX SDK's.

I decided to download an old DirectX SDK, in my case August 2007.

I compiled the .exe with the old DirectX SDK and then the .exe and effect runs just fine!

To Summarize

D3DXCreateEffectFromFile in SDK 2007: OK

D3DXCreateEffectFromFile in SDK 2010: UNKNOWN FAIL

What black sorcery is causing this!?

Advertisement

Ok now it get's even funnier.

My .exe that runs on DirectX June 2010 uses d3dx9_43.dll -> D3DXCreateEffectFromFile ERROR

My .exe that runs on DirectX August 2007 uses d3dx9_35.dll -> D3DXCreateEffectFromFile OK

So now the funny part:

I copy d3dx9_35.dll and rename it to d3dx9_43.dll, et voila, it works.

Definitely bug in DirectX SDK's

K it's because I didnt redistribute Jun2010_D3DCompiler_43_x86.cab

dry.png

EDIT: full solution explanation below

I've been having problems with the effect library as well, in fact, I got an error on that same exact function. Where do you find d3dx9_43.dll?

View my game dev blog here!

Delay loading this dll should solve the problem.

Basically, use the effects if the dll loads successfully, otherwise use the D3D pipeline itself.

Above is applicable only when it isn't absolutely necessary to use effects.

This particular dll isn't necessarily present on all the machines.

It's generally present under system32 folder.

It's true that most distributables are shipping this dll to strictly use effects.

I resolved the problem.

It appears that for the June 2010 SDK (d3dx9_43.dll) and the one before that, Feb 2010 (d3dx9_42.dll), just supplying these dll's in the redistribute files to the end user is not enough to ensure that Effect class can be used.

Initially I believed supplying only the Jun2010_d3dx9_43_x86.cab redistribute file to the end user was enough. But for the mentioned SDKs it's not enough (special cases).

You need to supply all the Jun2010_*.cab files. (The one important to fix bug in this topic is Jun2010_D3DCompiler_43_x86.cab file)

So what I do now is just supply all the Jun2010_*.cab files as found in the \Microsoft DirectX SDK (June 2010)\Redist\ to the end-user. And the DSETUP.dll, dsetup32.dll, DXSETUP.exe, dxupdate.cab also found in that folder.

Then, force the client to execute DXSETUP.exe (to install the redist files) if LoadLibrary("d3dx9_43.dll") fails (test that in a launcher or something before running the actual game .exe).

So it was just a matter of not supplying all the right redistribute files to the end user because of a misunderstanding.

Problem is that it's not properly documented in MSDN and that there's no proper error message inside the function to tell you some files on the system are missing.

Btw that error code corresponds with this:

HRESULT: 0x8007007e (2147942526)
Name: ERROR_MOD_NOT_FOUND
Description: n/a
Severity code: Failed
Facility Code: FACILITY_WIN32 (7)
Error Code: 0x007e (126)

Which then leads to you having to check whether all the dlls that the application needs are present. Simple google fu would have found that from the error name.

When faced with an undocumented error code from a DX call it is likely this will actually be a WIN32 Error and these you can also look up on MSDN. The DX SDK also ships with a nice tool for translating error codes into readable errors which is in your SDK utils directory and is called DirectX Error Lookup, which I used to get the above info.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

your game has to run the installer using CreateProcess, or shell execute or equivalent, using this command line:

path-to-redistributable\dxsetup.exe /silent

cf.

http://msdn.microsoft.com/en-us/library/windows/desktop/ee416805(v=vs.85).aspx

and there are ways to make an installer embedding this step:

http://wix.sourceforge.net/manual-wix3/install_directx9.htm

not as on topic but interesting:

http://msdn.microsoft.com/en-us/library/windows/desktop/ee418797(v=vs.85).aspx

This topic is closed to new replies.

Advertisement