如何在版本之间迁移? [英] How can I migrate between versions?

查看:99
本文介绍了如何在版本之间迁移?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从DirectX 10到11有什么变化?我已经在DirectX 10中编写了一些代码,我想将其更改为DirectX11.这仅仅是为了提高质量,我可以通过更改标头和dll文件或更改函数和编码方式来做到这一点吗?

What are changes from directx 10 to 11? Ive written some code in directx 10 and I want to change it to directx 11. Is this just about quality and I can do it just by changing headrs and dll files or functions and way of coding have been changed? ing.

推荐答案

首先,我要说的是,只要将D3D10DoSomething()函数更改为D3D11DoSomething(),一切都不会改变.他们会做同样的事情.无被动增益.您必须明确地使用新功能才能使您的应用程序更好. D3D10不具备的那些功能:例如硬件镶嵌,计算着色器,

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.

因此,主要问题是您真的需要此功能"吗?或者,也许是以后需要这些功能"吗? 当您看到古老的D3D10代码时,您的编码伙伴会笑吗?

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?

如果回答是:

DirectX 10到11的移植非常简单.与DirectX 9到10的移植相比,这只是个玩笑.

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

在将D3D10移植到D3D11时,要做的事情很简短且不详尽:

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

  • 备份您的来源
  • 获取文本查找替换工具(例如在Visual Studio或grep中),找到"D3D10"并替换为"D3D11"
  • #include <d3d10*>替换为#include <d3d11*>
  • 在链接器选项中
  • d3d10*.lib替换为d3d11*.lib
  • 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

创建设备和上下文:

  • 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()

其他内容:

  • 某些函数接受其他参数.在大多数情况下,您可以暂时通过0,直到不需要此功能为止.如果您遇到与参数数量有关的编译器错误或无法转换参数..",只需在
  • 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 =)

着色器:

  • 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.

这是Microsoft的其他提示:链接链接.

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

好吧,大都完成了!欢迎来到D3D11世界=)

Well, mostly done! Welcome to D3D11 world =)

这篇关于如何在版本之间迁移?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆