Jump to content
  • Advertisement
Sign in to follow this  
DwarvesH

I don't get SharpDX

This topic is 2134 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

I'm trying to port some DirectX and XNA samples to SharpDX, but I don't get the structure of the project. There is a ton of code in the repository. A ton of clean C# code that is way beyond a wrappers or a set of P/Invokes like I would expect it to be.

 

So what's up with that? I don't want to use some library that exceeds the scope of DirectX. How to make sure that I am using only the bare minimum of wrappers? There is barely any documentation for it.

Share this post


Link to post
Share on other sites
Advertisement
Well, here's a recommendation:

If you want the bare minimum of wrappers, stick to the parts of the framework that are under the appropriate namespaces for those components you're using.

Share this post


Link to post
Share on other sites

Like Washu said...SharpDX has a "Toolkit" that tries to be a bit like XNA, higher level functionality for batching, animation, some content loading, SpriteBatch, etc. But ignoring that, you're left with just the wrapper to Direct3D - e.g. SharpDX.Direct3D11 is D3D11 and nothing more, practically a 1:1 wrapper.

 

Also worth mentioning, SharpDX is not your average wrapper to begin with. The wrapper API is generated from the DirectX SDK headers. This is probably a bit out of date, but I dug up an old post by the author when SharpDX was first taking shape.

Share this post


Link to post
Share on other sites

Like Washu said...SharpDX has a "Toolkit" that tries to be a bit like XNA, higher level functionality for batching, animation, some content loading, SpriteBatch, etc. But ignoring that, you're left with just the wrapper to Direct3D - e.g. SharpDX.Direct3D11 is D3D11 and nothing more, practically a 1:1 wrapper.

 

Also worth mentioning, SharpDX is not your average wrapper to begin with. The wrapper API is generated from the DirectX SDK headers. This is probably a bit out of date, but I dug up an old post by the author when SharpDX was first taking shape.

 

Yeah, that's why I choose SharpDX over SlimDX. And the claimed better marshaling. Anyway, upon further inspection I realized that a lot of the code I saw was actually auto-generated, but the generator outputs at such quality that it looks like hand written code.

 

I'll go ahead and try and use SharpDX and I'll avoid the toolkit for now since I'm fearing another XNA incident. My project won't survive an infinite amount of ports :).

Share this post


Link to post
Share on other sites

I don't know if you're using D3D11 or not (Toolkit is only D3D11), but I wouldn't dismiss the SharpDX toolkit. It's XNA like, but its really just a nice wrapper ontop of the raw D3D11 API. So you get a lot of helper functionality when it comes to creating resources and so on. It also has its own Effects implementation, not utilizing Effects11. Those are wins if you're consuming the library raw without an engine or other framework involved. Unless if you're looking to create those things yourself :)

Share this post


Link to post
Share on other sites

I'm trying to port my engine and game over to SharpDX from XNA. I have been eliminating XNA features for the past few months and now I have decided to go dual version if possible: XNA and SharpDX. I might enhance the partial classes from SharpDX with some methods from AXN to increase comparability if needed in the base types (Color, Vector3...)

 

I am not using DirectX 11. Just 9. I am very ambitious and a perfectionist, so if I touch DirectX, I won't rest until my engine has the same feature parity as the first DirectX 11 titles, so I'll finish it in 20 years. DirectX 9 has pretty much all I need.

Share this post


Link to post
Share on other sites


I am not using DirectX 11. Just 9. I am very ambitious and a perfectionist, so if I touch DirectX, I won't rest until my engine has the same feature parity as the first DirectX 11 titles, so I'll finish it in 20 years. DirectX 9 has pretty much all I need.

 

Of course, in twenty years the world will have already moved on to DirectX 17... with even more features to achieve parity to happy.png

Share this post


Link to post
Share on other sites

Son of a gun. My reputation is now 666, mark of the beast.

 

I'd seriously re-consider using Direct3D11 instead of 9. Functionality aside, it's a lot cleaner and more organized API. I don't know whether or not you're also using D3D9 for the fixed function also, but at this point the programmable pipeline is no longer just "wave of the future" - its the present! :P. That usually seems to be the big selling point for sticking with D3D9, the fixed function piepline...but I think it hurts more than it helps in the long run because you're not working with something considered current. Shaders aren't really that scary ;). I don't know if it applies to you, it's just me saying.

Share this post


Link to post
Share on other sites

Son of a gun. My reputation is now 666, mark of the beast.

 

I'd seriously re-consider using Direct3D11 instead of 9. Functionality aside, it's a lot cleaner and more organized API. I don't know whether or not you're also using D3D9 for the fixed function also, but at this point the programmable pipeline is no longer just "wave of the future" - its the present! tongue.png. That usually seems to be the big selling point for sticking with D3D9, the fixed function piepline...but I think it hurts more than it helps in the long run because you're not working with something considered current. Shaders aren't really that scary ;). I don't know if it applies to you, it's just me saying.

 

Gj! I will catch up to you eventually tongue.png.

 

I am using shaders. I have 342 KiB of shader code currently in use to render my scenes. While I am still struggling with some basics (http://www.gamedev.net/topic/645950-dhpoware-demos-normal-mapping-unexpected-result/), I am using a pretty advanced render profile, that combines blinn-phong with spherical harmonics and ambient normal-mapping to achieve a normal mapping effect in the absence of light, where the total contribution of diffuse lighting from all light sources is zero (n dot l = 0). I don't know if the method has a name, because I started with simple and buggy blinn-phong a few months ago and kept adding to it and refining it.

 

As for DirectX 11, I don't like the idea. I couldn't care less about the API because I only need it to load shaders, send buffers to the GPU and create render targets. This is negligible to the thousands of line of code in the engine that are DirectX agnostic. So I would get very little advantage from DirectX 11. 

 

But a ton of disadvantages. As a one man team trying to write a top quality engine and eventually sell a game, I feel like I need to deliver more and better than a respectable and established developer with a publisher. My engine should run well on all hardware and operating systems. Otherwise, the effort in developing a new engine is not worth it. I could have started with Unity or something and develop my game from there.

 

DirectX 11 limits you to in version of Windows you can use. I want to run on Windows XP. I am also avoiding newer developments in GPU technology and only using pixel shader 3 without vertex texture lookup and have fallback version with pixel shader 2.

 

The only thing i am really missing in DirectX 9 is alpha to coverage. I might get it to work in DirectX9, but not in XNA.

 

And another problem with Direct11 is tessellation. I have brick walls. Brick walls look great with tessellation. Thus if I go with DirectX 11, I need to learn tessellation an implement a tessellation scheme that works great with forward rendering and multiple point light support.

 

And then there is the Microsoft problem. Back in the day there was a big hate for Microsoft in certain circles of the Internet (the M$ phenomenon). But back then I never had a problem with them. They created in general really great software.

 

But lately, with Windows 8, their treatment of .NET, C++/CX and the Xbone have left me wary of Microsoft. I would be really surprised if DirectX 12 will come out under an operating system that I would like to use and from a company who has made decisions leading up to that release that I can respect.

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!