How to remove dependency on DirectX SDK?

Coordinator
Jun 9, 2010 at 7:04 AM
Edited Jun 9, 2010 at 7:19 AM

Time to start a discussion about problems/dependencies with having to in install the DirectX SDK.

 

Coordinator
Jun 9, 2010 at 7:06 AM

I have many request to remove this dependency.    It has been tried several times, and each time  have not been able to get it to work.

The goal is to have a small installer that installs just the essential files for the shader binary compiler.

Coordinator
Jun 9, 2010 at 7:15 AM

Currently Shazzam uses FXC.exe to compile the shader.  It checks for the FXC file, and if it is available, calls Process.Start to compile the binary.

The only way to get this file and it's dependency dlls is to install the SDK.

From using DependencyWalker I see that FXC calls functions in D3DX9_43.DLL and D3DCOMPILER_43.DLL

Currently I am using the June 2010 SDK

 

Coordinator
Jun 9, 2010 at 7:18 AM

jmorrill submitted some code that pinvokes to D3DX10d_xx.dll or D3DX9_xx.dll.  His code works on my develpment box, but when i run the app on a virgin install of Windows 7 it throws a null reference exception.

 

Coordinator
Jun 9, 2010 at 7:25 AM

According to the docs Installing DirectX with DirectSetup I should be able to install a subset of the directX redistributables.   I've tried that, it works, I can see the files in windows\system32 and windows\syswow32, but the application still wont' work on the Win7 VM.

 

 

Jun 9, 2010 at 7:38 AM

One option, that I don't know how acceptable it is to you, is to bundle the directx web installer (280kb).  I ran it on a virgin Windows 7 VM and it told me it needed to install 48megs of binaries.  After installation the D3DX10 and D3DX9 files were in my windows system folder.  I know it's not as good as just including some D3D dlls and being done with it, but it's smaller than the 600meg D3D SDK ;).

On this page there is a list of downloads for Direct3D.
http://www.microsoft.com/downloads/en/resultsForProduct.aspx?displaylang=en&productID=9C954C37-1ED1-4846-8A7D-85FC422D1388

The first link "DirectX End-User Runtime", has the dx web installer.

What do you think?

Coordinator
Jun 9, 2010 at 7:48 AM

I'll settle for that, it's a stopgap measure and better than the current solution.   I had the same experience as you, with the silall.  Took about 5 minutes on the VM ot get the files installed.

Coordinator
Jun 9, 2010 at 7:49 AM

Right now, shazzam is crashing in funny ways on the VM,   still trying to track down why.

 

Coordinator
Jun 9, 2010 at 7:57 AM

jer.

 Is there a reason you chose d3dx10_40.dll?  I installed the latest SDK today and changed the code to use d3dx10_43.dll.   Now I'm getting null ref exceptions.

Jun 9, 2010 at 8:04 AM

The choice of the d3d dll version was actually just random.

Also I checked out the error code, and its an E_FAIL (0x80004005) aka "Unspecified error" (go figure).

Jun 9, 2010 at 8:05 AM

Does the D3D9 call fail also?

Coordinator
Jun 9, 2010 at 8:21 AM

Currenlty on my laptop if I set bool useDx10 = false;

it calls the D3D9 call and works as expected.

If I set bool useDx10 = true;

 and use d3dx10_40.dll in the DllImport it works as expected.  If I change to d3dx10_43.dll it throws an exception.

On the Win7 VM however it doesn't matter which one I choose.  AS soon as i compile a shader, shazzam crashes.

Coordinator
Jun 9, 2010 at 8:23 AM

According to the VM crash dumps it failing in ntdll.dll

Coordinator
Jun 10, 2010 at 6:52 AM

Article about installing FXC.exe and D3DCompiler

http://blogs.msdn.com/b/chuckw/archive/2010/04/22/what-s-up-with-d3dcompiler-xx-dll.aspx

Coordinator
Jun 11, 2010 at 5:50 AM

This is getting closer.

I have a working version of Shazzam with no dependencies on the DirectX SDK or the DirectX runtime files.  I've test on on a clean Win7 VM and it appears to be working successfully.

Jun 11, 2010 at 5:56 AM

Is it the D3DCompiler_*.DLL that you are using?

Coordinator
Jun 11, 2010 at 6:25 AM

I've got Shazzam working by copying d3dx10_xx.dll, D3DCompiler_xx.dll, D3DX9_xx.dll to the install folder.   I'm currenly using the *_40 version of the files.  I tried the *_43 version from the June SDK but the I kept getting null reference exceptions in D3DX10CompileFromMemory.

I can send you a copy of the EXE's if you want to try on a clean version of the OS.

 

Coordinator
Jun 11, 2010 at 6:29 AM

I do have one issue however.  When I run on the VM Shazzam doesn't apply the effect if I  use PS_3_0.  It works on my dev box, but not on the VM.

Read more about Shazzam PS_3_0 support and changes to the UI at http://blog.shazzam-tool.com/index.php/2010/06/shazzam-1-3-coming-soon-with-ps_3_0/

Jun 11, 2010 at 6:15 PM
My windows 7 VM is no longer a virgin any more after I installed the DX SDK Bins the other night :(.

I need to reinstall a new VM first.  Let me see if I can get that done tonight!

Awesome stuff Walt.  I was starting to feel like that small bit of code was like pandoras box!

-Jer
Coordinator
Jun 12, 2010 at 6:18 AM

I don't think PS_3_0 is support on Virtual PC.  That is probably the reason the effect is not visible when I switch to te WPF 3 settings when running on Win7 VM 

 From MSDN

 If a valid PS 3.0 shader is loaded on a computer

that does not have hardware support for PS 3.0, the shader is ignored. If the shader is invalid, no exception is thrown.

 

Coordinator
Jun 12, 2010 at 6:22 AM

I added a call to

<font face="Consolas" color="#2b91af">

RenderCapability

</font>.IsPixelShaderVersionSupported(3, 0)

and it proves that PS_3 is not available on the VM.