Jump to content
  • Advertisement
Sign in to follow this  
Shd

Direct3D 11 - Pure HLSL or Effects

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys,

I started to play with Direct3D yesterday and realized that the Effects framework beyond being completely detached from the Direct3D's core interface and functions is also only supplied through it's source code ( no libraries or dlls ).

After reading a little bit more of the documentation I ended up compiling the source code and creating the .lib file.
I also managed to create the .dll file but since the interface is not explicitly exported this won't bring the dynamic linkage that I wanted...
( Is there any way to globally export everything? :P )

So my question is:
Should I use the Effects framework and end up with large binaries due to the static linkage,
or should I used pure HLSL and benefit from the dynamic linkage since for HLSL M$ supplies the dlls?

What do the experts suggests me to do?


Thank you very much in advance!

Share this post


Link to post
Share on other sites
Advertisement
Im not sure if it's changed in dx11 from dx9 but in dx9 it isnt seperate.

Also seriously with multi hundred gigabyte drives and really fast internet connections are you really going to worry about executable size on PC???!! (:

I say executable size on PC isnt something you should worry about.

However whether or not to use it, if it really is separate in DX11 maybe there is a good reason for it, such as it's not used anymore because there's something better now.

Basically I dont know but i dont think you should worry about executable size :P

Share this post


Link to post
Share on other sites
Thanks for your reply Atrix256,

Well, the problem with static linkage (as you said) isn't really the space that the final binary occupies...
The real problem is that every time a new version of the Effects11 library comes out I've to recompile it again and distribute my application once more.
With dynamic linkage the user was responsible to update the runtime libraries and most of the time I wouldn't have to recompile the code again.

I don't see the point of distributing the source code of Effects11 and force you to compile it and place all the code inside your application.
Don't get me wrong, it's extremely easy to do it... but why?
I just can't see the advantage of doing this :)

On the other hand ( and maybe as a very remote possibility ) could MSFT be hinting the developers to use pure HLSL instead of the Effects framework?
Doesn't seams to be the truth since they have made some very nice improvements in this last version!

What do you guys, who work daily with Direct3D 11, usually use?
Effects framework or pure HLSL shaders?

Share this post


Link to post
Share on other sites
This doesn't answer the question you asked. I'm just curious.
Quote:
The real problem is that every time a new version of the Effects11 library comes out I've to recompile it again ...

Why?

Share this post


Link to post
Share on other sites
Quote:
Original post by Buckeye
This doesn't answer the question you asked. I'm just curious.
Quote:
The real problem is that every time a new version of the Effects11 library comes out I've to recompile it again ...

Why?


Because static linkage implies that the machine code that you get from an external library ( in this case the .lib file created when compiling the Effects11 framework ) is going to be placed inside your application's executable ( or dll or lib ).
This means that linkage happens at compile time.

With dynamic link libraries this happens at runtime.

Example: Direct3D defines a low level interface that must be implemented by the Hardware Vendors such as NVidia and ATI ( i.e. the drivers ).
Every time that they send new drivers you don't have to recompile your D3D application since all the functionality provided by the drivers can be loaded at runtime

helped? :)

Share this post


Link to post
Share on other sites
I don't think that's true for the Effects11 lib. It only deals with the effects part, and separates the individual shaders and internally calls the D3DCompiler functions to actually compile them. If you don't need to use a new feature in a new version of the actual effects lib (if they even update it), you don't need to recompile it. You will still get the benefits of new D3D 11 versions if the compilers are changed.

Share this post


Link to post
Share on other sites
If your application would automatically get the new version of the Effects11-Framework when Microsoft releases it, what is going to happen if they change some functionality on which your program depended? What if they take out a function? Nobody would be able to play your game anymore.
When Microsoft releases a new DirectX, and you developed your game with an older version of the SDK, like February 2010, they simply put another DLL into the system32 folder. For example: All February 2010 Applications use D3D11_42.dll (Not sure about the name, but number is 42!). All Applications compiled with the SDK from June will leave the _42.dlls untouched and use some new and fancy _42.dlls.

If they update it, you will have to recompile. But only if you don't like the release you are working with. It's a normal procedure.

Share this post


Link to post
Share on other sites
I agree with the others - you would only update the new version if there was an improved feature set that you needed, and then you would test it just the same as you would any time you changed a library. I would also assume that your application would change more frequently than the Effects library...

With that said, I actually prefer to write my own code to interface with the shaders. It seems to be a difficult hill to climb at first, but once you have done it I think you understand how things work much better. If you would like a reference implementation, you can take a look at my engine (link is below). This will provide starter code (and lots more too...) if you don't know how to approach the task.

Share this post


Link to post
Share on other sites
Guys, thank you very much for all your replies!
You definitely cleared my mind in this matter! :)

Jason Z : I'll definitely take a look in your engine! I'm sure it will provide a lot of insight!
Also your engine's image is the same as mine: http://code.google.com/p/amun-graphical-engine/ :-)

Once again, thank you very much for all your replies!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!