Jump to content

  • Log In with Google      Sign In   
  • Create Account

SharpDx and d3dcompiler_XX.dll


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
5 replies to this topic

#1   Prime Members   

3005
Like
0Likes
Like

Posted 16 August 2014 - 12:18 PM

A few months ago, as my first real foray into C# programming, I wrote a small program/dll that allowed me to compile .hlsl and .fx files directly into COFF files that I could link into my program.  It worked great for a few months.  Now I'm having a small problem.  

 

In writing the dll I used the SharpDx package to get access to the D3DCompiler API.  It seems by default this uses an older version of the d3dcompiler_XX.dll (I think its version 43, I don't remember exactly).  I need to use a more recent version of the compiler dll, in particular I would like to use d3dcompiler_47.dll.  Being somewhat of a noob when it comes to C#, I haven't been able to figure how to do it.  Googling didn't turn up anything useful and I tried copying d3dcompiler_47.dll to various directories with no avail.  Anyone have and ideas? 



#2   Members   

1091
Like
1Likes
Like

Posted 16 August 2014 - 09:23 PM

If you are using nuget packages and building desktop applications, it will link by default the old DirectX June 2010 runtime. In order to use more recent d3dcompiler_47.dll (deployed on Windows8.x), you need to setup a config variable in your project

 

If you are referencing manually binaries, simply link against DirectX11_2-net40



#3   Prime Members   

3005
Like
0Likes
Like

Posted 17 August 2014 - 03:58 AM

I used the nuget packages, and read through the link you provided (much appreciated) but was still unable to get it to use the newer d3dcompiler_47.dll.  I never used C# before this so I'm probably making a silly mistake.  I added an App.config file (using the project->add new item wizard) and in there added <SharpDXDirectXVersion>DirectX11_2</SharpDXDirectXVersion>.  I'm not sure if I'm not doing the right thing, or if I added it to the wrong place, and TBH I don't even know what a config variable is.



#4   Members   

1091
Like
1Likes
Like

Posted 17 August 2014 - 05:37 AM

You need to add it to your csproj like it is done in this sample



#5   Members   

1570
Like
0Likes
Like

Posted 17 August 2014 - 07:00 AM

On another note, why not precompile with fxc and embed .cso files (compiled shader object) instead? This is what I do.



#6   Prime Members   

3005
Like
0Likes
Like

Posted 17 August 2014 - 07:15 AM

That worked, thank-you very much smile.png

 

@Fredricvo: This does 1 better.  I used C# because its works as an custom build step integrated with VS.  So I add the .hlsl or .fx files as you would, but under 'item type' I select my task instead of the default hlsl compiler.  It compiles the code and instead of saving it as a .cso file as COFF object which can be directly linked into the executable, and which is done automatically.  I can give it whatever variable name I want and even use namespaces.  It's really easy.  I don't need to worry about custom build steps or anything, its all handled automatically for me.

 

I should also add.  There are only two problems I have with it.  1st is that effects are deprecated for the newer compiler; which both annoys and baffles me to no end.  Also the MSBuild scripting is not well documented, and so there are still small quirks that I need to work out.  The latter I can fix, the former... serves me right for using MS I guess...


Edited by Ryan_001, 17 August 2014 - 07:25 AM.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.