Sign in to follow this  
javrba

SlimDX Effect.FromFile error from MiniTri Sample

Recommended Posts

I'm new to SlimDX and have been trying to get the September 2008 Direct3D10 MiniTri sample running. I continue to have exceptions from Effect.FromFile. The .fx file appears valid and is in the correct directory. The output window shows "Module Not Found" for the exception. I haven't figured out how to download and debug the source (yet), but on inspection I find that the signatures of the two FromFile calls do not match in the Effect.cpp and Effect.h files. (The pool and include arguments do not appear in the .cpp file but are in the .h file - and the SlimDX documentation.) Any help would be appreciated.

Share this post


Link to post
Share on other sites
Can you perhaps explain more about your problem? I have no troubles running the D3D10 MiniTri sample here. Also, I'm not sure what you mean when you say that the two function signatures are different. I took a look and they are not.

Did you remember to run the SlimDX installer before trying to run the samples? If you didn't, they won't be able to find the SlimDX DLL and will mostly likely fail with some sort of assembly load exception.

Share this post


Link to post
Share on other sites
Thanks for the quick response. I did use the SlimDX installer. In fact, I've successfully used SlimDX with the XAudio2 components for a project I've just completed. I wanted to explore Direct3D 10 as a possibility for reworking an existing plotting library.

On my system, using the September 2008 version, when MiniTri attempts to execute its Effect.FromFile call (line 107 of Program.cs), I get the output shown between the lines below.

----
First-chance exception at 0x765ab09e in MiniTri.exe: 0xC06D007E: Module not found.
A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in SlimDX.dll
An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in SlimDX.dll

Additional information: External component has thrown an exception.
----

My investigation of Effect.cpp and Effect.h are from what I could see when browsing at

http://code.google.com/p/slimdx/source/browse/#svn/trunk/source

The files there appear to have mis-matched call sites. If the C# DllImport used the form in the .h file and the .cpp file was as I found it, an error like this would result. (I spent all last summer wrapping a C++ calculations library for .NET use, so I've seen many errors like this.)

I've tried to download SlimCX sources using TortoiseSVN and checkout commands similar to the one provided at

http://code.google.com/p/slimdx/source/checkout

but have never been able to connect with the server. I'm not familiar with SVN yet though, so that problem could well be user error.

Thanks for your help.

Share this post


Link to post
Share on other sites
Something doesn't sound right about that. If the application was unable to find the fx file, it would throw a Direct3D10Exception. An SEHException implies something deeper than that.

I'd suggest downloading from source and trying it there. You can then use unmanaged debugging coupled with the debug runtimes to see what's going. The problem you are seeing is in your checkout string. It should be "http://slimdx.googlecode.com/svn/trunk/", without the quotes. If you put that into TortoiseSVN, you should perform a checkout without any problems.

Also, I still don't understand what you mean by mismatched signatures. I'm look at Effect.h and Effect.cpp. These are the signatures I'm seeing:


// cpp file
Effect^ Effect::FromFile( SlimDX::Direct3D10::Device^ device, String ^fileName, String^ profile, ShaderFlags shaderFlags, EffectFlags effectFlags, EffectPool^ pool, Include^ include )
Effect^ Effect::FromFile( SlimDX::Direct3D10::Device^ device, String ^fileName, String^ profile, ShaderFlags shaderFlags, EffectFlags effectFlags, EffectPool^ pool, Include^ include, [Out] String^ %compilationErrors )

// h file
Effect^ FromFile( SlimDX::Direct3D10::Device^ device, System::String^ fileName, System::String^ profile, ShaderFlags shaderFlags, EffectFlags effectFlags, EffectPool^ pool, Include^ include );
Effect^ FromFile( SlimDX::Direct3D10::Device^ device, System::String^ fileName, System::String^ profile, ShaderFlags shaderFlags, EffectFlags effectFlags, EffectPool^ pool, Include^ include, [Out] System::String^ %compilationErrors );




They seem to match to me.

Share this post


Link to post
Share on other sites
Thanks again for responding so quickly. It's taken me quite a while to check everything out. I really thought I might be on to something this round, but now it appears that things are actually worse.

First, I went back to the browse tab of the Google SlimDX code site and do not see the discrepancy between the Effect.cpp and Effect.h that I saw yesterday afternoon. I must have done something odd when browsing/searching the files and somehow got hold of some older version of the .cpp file. Sorry for the wild goose chase on that one.

Your instructions for SVN did the trick and I have successfully downloaded the source. When I first tried to load the solution, I found that it was for VS 2008. I had been working in VS 2005. This gave me an excuse to install 2008 (which I'd been meaning to do anyway). A few hours later I was finally able to open and try to build the solution. Then I found what I thought might be my real problem - that the current version of SlimDX requires the August 2008 DirectX SDK. I was still using the June 2008 DirectX SDK version. After installing the latest DirectX version, I was able to build the latest SlimDX.

Once things built, I ran the current MiniTri executable (I just right clicked on the MiniTri project, clicked Debug and then told it to start a new instance.) I'm able to step through the app and the SlimDX code now. However, with the latest version of the code, I don't even get as far as loading the effects. I'm getting an exception from D3D10.Device.CreateWithSwapChain (line 85 of Program.cs). The output created by the call is shown between the two lines below.

-----
'MiniTri.exe': Loaded 'C:\Windows\System32\d3d10.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\d3d10core.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\dxgi.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\version.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\dwmapi.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\setupapi.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\wintrust.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\crypt32.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\msasn1.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\userenv.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\secur32.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\imagehlp.dll'
'MiniTri.exe': Unloaded 'C:\Windows\System32\setupapi.dll'
'MiniTri.exe': Loaded 'C:\Windows\System32\D3D10SDKLayers.DLL'
First-chance exception at 0x765ab09e in MiniTri.exe: Microsoft C++ exception: _com_error at memory location 0x002ce51c..
First-chance exception at 0x765ab09e in MiniTri.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
'MiniTri.exe': Unloaded 'C:\Windows\System32\D3D10SDKLayers.DLL'
A first chance exception of type 'SlimDX.Direct3D10.Direct3D10Exception' occurred in SlimDX.dll
An unhandled exception of type 'SlimDX.Direct3D10.Direct3D10Exception' occurred in SlimDX.dll

Additional information: DXGI_ERROR_UNSUPPORTED: Unsupported. (-2005270524)
-----

I should mention that I had a device creation problem in the earlier version too. However, in that case I followed the technique Microsoft used in their Direct3D 10 tutorials - when device creation with DriverType.Hardware failed, I tried again with DriverType.Reference. That "fix" worked with the earlier SDK, but now, when I try DriverType.Reference I get an "out of memory" exception.

I also tried to go back to the "released" Direct3D 10 version of the MiniTri sample (which has quite different device creation logic) and try it with the up-to-date DirectX SDK version. It gives the same type of errors as the current version does..

Before I go any further, I'll spend some time this weekend making sure that the August 2008 versions of Microsoft's C++ Direct3D 10 tutorials run with my current configuration.

Thanks again for your help.

Share this post


Link to post
Share on other sites
Yes, that's a much more reasonable error. Glad you got all the dependencies worked out. I would think from your error that your card doesn't support DX10, but you say you are using the reference device? In that case, it may be that you need updated drivers, as that's the only thing I could think of that would cause those issues. Do check the C++ samples included in the DX SDK. If those don't run, you'll know that that's your answer.

PS. While it's good that you got VS 2008, it is possible to downgrade the SlimDX project to 2005 using one of the MSBUILD scripts. Just throwing that out there.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this