[转]D3DCREATE_PUREDEVICE

What is the purpose of the D3DCREATE_PUREDEVICE flag?

 
D3DCREATE_PUREDEVICE 标记的作用是什么?

Use the D3DCREATE_PUREDEVICE flag during device creation to create a pure device. A pure device does not save the current state (during state changes), which often improves performance; this device also requires hardware vertex processing. A pure device is typically used when development and debugging are completed, and you want to achieve the best performance.

在创建设备过程中使用D3DCREATE_PUREDEVICE 标记来创建纯设备。纯设备并(在状态切换时)不保存当前状态,这样能提高性能。这种设备同时也需求硬件顶点处理。纯设备在调试和开发结束后使用,用作或者最好性能。

One drawback of a pure device is that it does not support all Get* API calls; this means you can not use a pure device to query the pipeline state. This makes it more difficult to debug while running an application. Below is a list of all the methods that are disabled by a pure device.

纯设备的缺点是它不支持Get*API() 调用,这意味着你不能够使用纯设备来查询设备状态。在运行调试程序时,这会比一般设备更困难。下面是在使用纯设备是不能调用的函数:

ID3D10Device9::GetClipPlane
ID3D10Device9::GetClipStatus
ID3D10Device9::GetLight
ID3D10Device9::GetLightEnable
ID3D10Device9::GetMaterial
ID3D10Device9::GetPixelShaderConstantF
ID3D10Device9::GetPixelShaderConstantI
ID3D10Device9::GetPixelShaderConstantB
ID3D10Device9::GetRenderState
ID3D10Device9::GetSamplerState
ID3D10Device9::GetTextureStageState
ID3D10Device9::GetTransform
ID3D10Device9::GetVertexShaderConstantF
ID3D10Device9::GetVertexShaderConstantI
ID3D10Device9::GetVertexShaderConstantB
 

A second drawback of a pure device is that it does not filter any redundant state changes. When using a pure device, your application should reduce the number of state changes in the render loop to a minimum; this may include filtering state changes to make sure that states do not get set more than once. This trade-off is application dependent; if you use more than a 1000 Set calls per frame, you should consider taking advantage of the redundancy filtering that is done automatically by a non-pure device.

纯设备的第二个缺点是它不会滤除任何冗余状态变化。当使用纯设备时,应用程序应该把状态改变减到最少,包括滤除那些对相同状态设置超过两次的操作。是否手动设置是依赖于应用程序的,如果你每帧使用超过1000次状态设置,你应该考虑滤除冗余状态设置,虽然这种操作会在使用非纯设备时会被自动执行。

 

As with all performance issues, the only way to know whether or not your application will perform better with a pure device is to compare your application's performance with a pure vs. non-pure device. A pure device has the potential to speed up an application by reducing the CPU overhead of the API. But be careful! For some scenarios, a pure device will slow down your application (due to the additional CPU work caused by redundant state changes). If you are not sure which type of device will work best for your application, and you do not filter redundant changes in the application, use a non-pure device.

和所有的性能问题一样,唯一知道你的程序在纯设备和非纯设备下哪个性能更好的方法就是比较它们在两种设备下的运行速度。纯设备具备提高程序性能的潜力,因为它减少了程序CPU开支。但是要特别注意对于某些场景纯设备会减慢你程序的运行速度(因为由于冗余状态改变增加了附加CPU操作)。如果你不知道哪种类型设备效率最高,同时你也不想做应用程序状态的冗余状态改变,你应该使用非纯设备

原文地址:https://www.cnblogs.com/crazii/p/1745234.html