How can I migrate between versions?

岁酱吖の 提交于 2019-12-06 16:01:44

First, I need to say, that nothing will change if you just change your D3D10DoSomething() functions to D3D11DoSomething(). They will do same things. No passive gain. You must use new features explicitly to make your app better. Those features that D3D10 don't have: such as hardware tessellation, compute shader, many many other stuff. To code.

So, the main question is "do you really need this features"? Or, maybe, "will you need these features later"? Does your coding mates laughing when see your ancient D3D10 code?

If answer is yes:

DirectX 10 to 11 porting is very simple. It is just a joke compared to DirectX 9 to 10 porting.

Here is short and non-exhaustive list of things to do when porting D3D10 to D3D11:

  • backup your sources
  • get text find-replace tool (such as in Visual studio, or grep), find "D3D10" and replace to "D3D11"
  • replace #include <d3d10*> to #include <d3d11*>
  • replace d3d10*.lib to d3d11*.lib in linker options

Device and Context creation:

  • In D3D11 device interface splitted to device and context, so device now responsible for creation functionality (most methods are Create*()) and context responsible for state changing functionality (most methods are Set*()/Get*()).
  • Where you create device with one of the D3D10CreateDevice*functions (now they've become D3D11CreateDevice*), add additional ID3D11DeviceContext parameter and also add parameters related to D3D_FEATURE_LEVEL. (more about feature levels here)
  • Change device->ChangeState() calls to deviceContext->ChangeState()

Other stuff:

  • Some of functions accepts additional argument(s). Most times you just can pass 0 for the time until you don't need this functionality. If you get compiler errors related with number of arguments or "unable to convert parameter.." just find this function in DirectX 11 reference and see if you must add additional zero argument =)

Shaders:

  • Vertex, Geometry, Pixel shaders mostly unchanged, so you can safely use old ones.
  • If you using Effect10 framework, things can be more complicated, but still porting will take one hour of time or so. Refer to Microsoft site or Google when you have questions.

And here are additional tips from Microsoft : link, link.

Well, mostly done! Welcome to D3D11 world =)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!