Graphics APIs in Windows Vista

 

Graphics APIs in Windows Vista

By Chuck Walbourn, Software Design Engineer

Microsoft Game Technology Group

Windows Vista includes support for an entirely new display driver model that represents a major revision in the design of video drivers since the introduction of the Windows Driver Model (WDM) for Windows 98. This redesigned model reflects the evolution of video hardware from the world of 2D raster operations and GDI applications, to that of 3D games with fixed-function graphics hardware, to that of the modern programmable graphical processing unit (GPU) that supports a wide-range of high-performance graphics applications.

Windows Vista支持了一个全新的显示驱动模型,该显示驱动模型体现了自从Win98引入Windows驱动模型(WDM)之后主要的变动。这个重新设计的模型反映了视频硬件从2D光栅化操作和GDI程序到使用固定管线图形硬件的3D游戏乃至现代支持大量的高性能图形程序的可编程图形硬件的发展过程。

Background

The primary API for programming graphics since the early days of Windows has been the Graphical Device Interface (GDI). This API was designed to handle a plethora of 2D output devices and formed the basis for the Windows user interface experience. DirectDraw and Direct3D were introduced as alternative APIs to support full-screen games and 3D rendering as extensions to the existing hardware of the time. Interactions with GDI were complicated, and the effective intermixing of traditional GDI elements with Direct3D elements has been limited by this design. The Windows XP version of WDM, known as XPDM, reflects the side-by-side nature of GDI and Direct3D (see Figure 1).

早期Windows的主要图形编程API是图形设备接口(GDI),它被设计用于操作大量的2D输出设备和组成Windows用户界面体验的基础。DirectDraw和Direct3D作为支持全屏游戏和三维绘制引入的可替换API引入,在当时是作为已存在的硬件的扩展。和GDI交互很复杂,并且这种设计限制了Direct3D元素和传统GDI元素的混合效果。Windows XP版本的WDM(就是XPDM)反映了GDI和Direct3D的这种状况(见图1)。

Over the years, the power of 3D video cards has grown dramatically to the point where the vast majority of hardware is dedicated to this function. A new driver model, Windows Vista Display Driver Model (WDDM), brings the GPU and Direct3D to the forefront, allowing the creation of an entirely new experience, the 3D desktop, that seamlessly blends the 2D world of GDI with the power of modern programmable GPUs. With WDDM, the video hardware is driven entirely by Direct3D, and all other graphics interfaces communicate with the video hardware via the new Direct3D–centric driver model (see Figure 2).

几年来,3D显卡的能力迅速增长,主流硬件一直致力于实现上述功能。一个新的驱动模型,Windows Vista显示驱动模型(WDDM)把GPU和Direct3D带到前台,允许创建一种全新体验,运用现代可编程GPU使3D桌面和GDI的2D世界实现无缝混合。使用WDDM,显示硬件完全由Direct3D驱动,其他所有和图形硬件进行交流的图形界接口都通过这个新的以D3D伟中心的驱动模型进行(看图2)。

 

Direct3D 9

Version 9 of DirectX was first released for Windows in 2002, with subsequent updates in 2003 and 2004. This API represents a decade of evolution of the DirectX technologies, the introduction of more powerful shader programming models for Direct3D, and a maturity backed by thousands of shipping titles. Direct3D 9 is the primary graphics interface on Windows Vista, and it remains the ideal API to use for writing 3D games and applications that need to run on the broad range of existing hardware and Windows releases. The details of the new driver model are hidden from applications using the Direct3D 9 interfaces, but behind the scenes the operating system is taking full advantage of the new capabilities to provide true multitasking of the GPU, more efficient resource management, and robust performance.

DirectX第9版2002年在Windows首先发布,在2003和2004年做了更新。该API代表了DirectX技术十年来的发展,它为Direct3D引入了更为强大的Shader可编程模型,为数以千计的厂商支持。Direct3D9是Windows Vista的主要图形接口,它保留理想的接口用作编写运行在大量已存在的硬件和发布的Windows版本上的3D程序和接口。新驱动模型细节被D3D9接口隐藏,但在幕后操作系统能够充分利用驱动模型的新特性去提供真实的GPU多任务,高效资源管理和稳定的性能。

To ensure full compatibility with older versions of Windows, some quirks of the old driver model must be emulated even with the new Windows Vista display driver model. For example, when a full-screen application loses focus, it must assume it has lost all the resources in video memory (VRAM) and reload those it created as unmanaged resources even though the new driver model handles the resources transparently without evicting them from the device context. Even the concept of a managed vs. default resource type is specific to the old driver model. Another example is the expectation of failure when allocating unmanaged (default pool) resources in excess of the amount of VRAM available, even though the new driver model can provide a nearly unlimited amount of virtual video memory. Because of these requirements, Direct3D applications running on Windows Vista will still receive these error conditions, and thus are limited in their ability to fully utilize some features of the new driver model using the basic Direct3D 9 interfaces.

为了保证和老版Windows兼容,一些旧驱动模型的不良特性也会被新Windows vista显示驱动模型效仿。比如说全屏程序会丢失焦点,它会假设它丢失了显存(VRAM)中所有资源并重新导入以unmanaged格式创建的资源,即便新驱动模型直接管理资源而不需要从设备上下文中重新导入。Managed资源类型就是专为旧驱动模型定义的概念,对应Default类型。另一个例子是在分配unmanaged(在default pool)中的资源时,如果数量超过了显存大小,就会返回一个错误值,即便新驱动模型能够提供几乎无限的虚拟显存。因为兼容的要求,在Windows Vista上运行的程序仍然会收到这些错误条件,因此使用基础Direct3D9接口限制了它们充分利用新驱动模型特性的能力。

While new systems shipping with Windows Vista will include video cards with WDDM drivers, and new drivers for a number of popular video cards are included in the box, Windows Vista continues to support the ability to use older XPDM drivers for upgrades and corporate editions. On systems using the old driver model, Direct3D 9 and older interfaces must be used, and the operation of the graphics system is very similar to that of Windows XP (Figure 1). WDDM is required for applications to use Direct3D 9Ex, Direct3D 10, and later versions.

安装Vista的系统必须有具备WDDM驱动的显卡,Vista会自带一些流行显卡的驱动程序,同时也继续支持使用旧的XPDM驱动的升级和正式版本。在使用旧驱动模型的系统上必须使用Direct3D9其他旧接口,对图形系统的操作和WindowsXP类似(图1)。使用Direct3D 9EX,Direct3D10及其后继版本的程序要求使用WDDM。

Direct3D 9Ex

The Direct3D 9Ex interface provides access to a slight extension of the standard Direct3D 9 API that exposes the virtualized resource allocation, new lost device semantics, and some other new features available while running on Windows Vista. By creating this extended object, the Direct3D 9 API uses the new semantics and therefore requires the application to use different logic (and therefore different code paths) for resource creation, management, and error handling for new kinds of conditions. This API is only available on Windows Vista, and it requires WDDM drivers. Because Direct3D 9Ex uses a separate API and driver code path than Direct3D 9, supporting this API requires additional test cases for your application。

Direct3D 9Ex接口提供了对标准Direct3D9 API简单扩展的操作,包括虚拟资源分配,新的“设备丢失”语法和在Vista运行时的其他新特性。D3D9接口在扩展对象生成后可以使用新的语法并且需要程序使用不同的逻辑(和不同的代码路径)来在新条件下创建资源,管理资源和出错处理。该API只在Vista上可用,需要WDDM。因为Direct3D 9Ex使用和Direct3D 9不同的API和驱动代码路径,所以支持该API需要应用程序提供附加的测试程序。

The primary reason for creating the new Direct3D 9Ex API was to allow full access to the new capabilities of WDDM while maintaining compatibility for existing Direct3D applications. The new 3D desktop and many Windows Vista-specific applications make use of this version of Direct3D 9, but they are not functional when running on older XPDM drivers. Because the Direct3D 9Ex API will never appear on older versions of Windows due to a lack of support for the WDDM, the standard Direct3D 9 interfaces cover a much broader set of systems. For high-performance applications that can take advantage of the next generation of video hardware, the entirely new version 10 of Direct3D provides many new capabilities not exposed by Direct3D 9Ex. As a result, for games and most other applications, Direct3D 9 or Direct3D 10 is the recommended API.

创建新的Direct3D 9Ex API接口的主要目的是为了让用户能完全使用WDDM的新能力同时和已存在的Direct3D程序兼容。新的3D桌面和许多Vista程序用到了新版本的Direct3D9,但是在旧的XPDM驱动上无法运行。因为Direct3D 9Ex因为旧操作系统不支持WDDM而无法运行,标准的Direct3D 9接口使用的更广泛。对于能够使用下一代图形硬件的高性能图形程序,全新的Direct3D 10版本提供了更多Direct3D 9Ex没有提供的功能。对于游戏和其他大多数程序,D3D9和D3D10同时被推荐。

Note    The DirectX SDK does not provide samples, headers, or libraries for the Direct3D 9Ex interface. The MSDN Library and Windows SDK (formerly known as the Platform SDK) contain the available documentation, headers, and libraries.

For more information about Direct3D 9Ex, see DirectX for Windows Vista on MDSN.

注意: DirectX SDK没有提供Direct3D 9Ex接口的例子,头文件和库。MSDN库和Windows SDK(就是从前的Platform SDK)包含了相应的文档,头文件和库。

Direct3D 9Ex的更多信息请看MDSN上的DirectX for Windows Vista一节。

Direct3D 10

To fully realize the potential of the new Windows Vista driver model and next-generation hardware, an entirely new version of the Direct3D API has been created. While WDDM eliminates some of the limitations on performance in the existing graphics system, Direct3D 10 goes further by removing design bottlenecks in the existing Direct3D API and greatly simplifies the task of programming the GPU.

为了完全实现新的Windows Vista驱动模型和下一代图形硬件的潜能,一个全新版本的Direct3D API接口被创建了。因为WDDM剔除了一些当前图形系统上对性能的限制,Direct3D 10在移除当前Direct3D API设计瓶颈和简化GPU可编程任务方面走的更远了。

The new API completely eliminates all but a few fixed-function aspects, replacing them with programmable constructs and greatly streamlining the internal implementation. The hundreds of capability bits in previous versions of Direct3D have been completely eliminated and replaced with a well-defined, inclusive set of functionality that has only a few optional usage scenarios for specific resource formats. CPU-intensive resource creation and validation now have explicit semantics in the new API, allowing for much more predictable performance behavior and greatly reduced per-draw overhead. Resources can be reconfigured into multiple forms to allow efficient use at various stages, and the feature set imposes far fewer restrictions on usage scenarios for formats. There area also new block-compressed normal-map texture formats.

新的API接口几乎完全移除了固定管线功能,取而代之的是可编程构造器和极度流水线化的内部实现。数以百计的旧Direct3D版本的功能被取消,代之以明确定义的内部功能集合,它只有一些对特殊资源的可操作选项。CPU资源创建和生效在新API里有明确定义,使得用户能对性能进行进一步预估,大量降低了每次绘制的开支。资源能够被描述为不同类型使之在不同阶段都能被有效使用;新特性减少了对不同类型资源使用的限制,还包括了新的逐块压缩的法向图纹理格式。

In the new API, shader constants and device state are explicit resources, allowing for far more efficient caching on the hardware and greatly simplified driver validation. The programmable shader model has been unified across both vertex and pixel shaders, and made more expressive with a well-defined computational model and operator set. Also, a new geometry shader stage has been added to operate on primitives after the vertex shader stage. The results of the GPU’s work in the vertex and geometry shader stages of the pipeline can be streamed out to video RAM for reuse, allowing for the possibility of extremely complex multi-pass GPU operations with minimal CPU interaction.

在新接口中,Shader常数和设备状态是明确定义的资源,允许更高效的在硬件上缓存和简化驱动使用。可编程Shader模型把VS和PS统一在一起,使用明确定义的计算模型和操作集合,使之更具表现力。同时,一个新的GS阶段被引入在VS之后做逐图元操作。GPU在VS和GS阶段工作的结果可以输出到显存中被再次使用,这使得使用最小的CPU交互实现极度复杂的多遍GPU操作成为可能。

All of these enhancements enable next-generation graphics technology and expand the ability of applications to off-load work to the GPU. Offloading allows more complex GPU-based character skinning, accelerated morphing techniques, shadow volume generation and extrusion, particle and physics systems that are entirely GPU-based, more complex materials combined into efficient large-draw batches, procedural detailing, real-time ray-traced displacement mapping, single-pass cube-map generation, and many more techniques — all while freeing up CPU resources for more complex applications.

这些性能的强化使得下一代GPU技术得以使用,并且扩展了应用程序把工作托付给GPU的能力。GPU能够被托付完成更复杂的基于GPU的表面细节,加速变形技术,Shadow Volume生成和抽取,完全基于GPU的粒子和物理系统,更复杂的材质合成,过程细节,实时光线跟踪,替换贴图,单pass立方纹理生成和其他更多的技术——在此同时解放了CPU资源用以运行更复杂的程序。

To provide this level of innovation in Direct3D 10, older hardware cannot be expressed as a partial implementation of a new interface. A video card is either capable of supporting all of the new features, or it’s not a Direct3D 10–capable card. Therefore, while Direct3D 9 could drive DirectX7-era hardware with many missing capability bits and usage limitations, Direct3D 10 only works on a new generation of video cards. For an application to support older video hardware, it must also support the Direct3D 9 interfaces.  Future versions of Direct3D will build on version 10, extending it to new versions of the API while ensuring a strict superset of Direct3D 10 functionality.

为了体统这个层次的Direct3D 10的功能,旧的硬件可以被表现为新接口的部分实现。显卡可以是支持所有D3D10特性的,或者不是一个完全支持D3D10的卡。同时,和D3D9能够驱动DX7时代硬件但是会丢失很多新特性和受到使用限制不同,D3D10之在新一代显卡上工作。对于想支持旧显卡的程序,它必须支持D3D9接口。将来的Direct3D将基于DX10,扩展后的新版本接口会确保成为D3D10功能的一个严格的父集。

For more information about Direct3D 10, see the DirectX SDK documentation for DirectX 10.

D3D10的更多信息参见DirectX SDK DirectX10文档。

OpenGL

Windows Vista provides the same support as Windows XP for OpenGL, which allows video card manufactures to provide an installable client driver (ICD) for OpenGL that provides hardware-accelerated support; note that newer versions of such ICDs are required to fully support Windows Vista. If no ICD is installed, the system will fall back to the OpenGL v1.1 software layer in most cases.

Windows Vista对OpenGL提供了和Windows XP一样的支持,允许显卡厂商提供可安装的OpenGL客户端驱动(ICD),以提供硬件加速支持。注意更新版本的ICD需要完全支持Windows Vista。如果没有安装ICD,系统在许多情况下会回到OpenGL1.1软件版本。

Application Compatibility, GDI, and older versions of Direct3D

The Windows Vista graphics system is designed to support a broad range of hardware and usage scenarios to enable new technology while continuing to support existing systems. Existing graphics interfaces, such as GDI, GDI+, and older versions of Direct3D, continue to work on Windows Vista, but are internally remapped where possible. This means that the majority of existing Windows applications will continue to work.

Window Vista图形系统被设计为支持大量硬件和各种使用环境下使用新技术同时支持已存在的系统。已存在的图形接口,比如GDI,GDI+和旧版Direct3D会继续在Windows Vista下工作,但是会在内部被重新映射到不同可能实现它们的区域。这意味这当前大多数Windows程序在Vista下能够继续工作。

Windows Vista continues to support the same Direct3D and DirectDraw interfaces as Windows XP, back to version 3 of DirectX (with the exception of Direct3D’s Retained Mode, which has been removed). Just as with Windows XP Professional x64 Edition, 64-bit native applications on Windows Vista are limited to Direct3D9, DirectDraw7, or newer interfaces. High-performance applications should make use of Direct3D 9 or later to ensure that they have the closest match to the hardware capabilities.

Windows Vista和Windows XP一样继续支持相同的Direct3D和DirectDraw接口,一直支持到DirectX 3版本(包括期望中的Direct3D中的保留模式,已经被移除了)。就像Windows XP专业x64版,Windows Vista上的64位程序只限制在Direct3D9,DirectDraw7或者更新的接口上运行。高性能程序应该使用Direct3D 9或者它的后继版本以保证它和硬件能力更为匹配。

Recommendations

Consider the following recommendations when selecting an API for your graphical application:

  • Use Direct3D 9 if your application must support Windows XP or an earlier version of Windows.
  • Use Direct3D 9 if you want to support Windows Vista running with XPDM drivers and upgraded systems that lack Direct3D 10–capable hardware.
  • Use Direct3D 10 to take advantage of the next generation of video hardware on Windows Vista

当为你的图形程序选择API时,考虑下列建议:

当你程序必须支持WindowsXP或者更早版本Windows时推荐使用Direct3D9

当你想在Windows Vista上使用XPDM驱动运行程序和和在升级后但是缺少Direct3D10能力硬件的系统上运行程序时,推荐使用Direct3D9。

使用Direct3D10在Windows Vista上使用下一代显卡的新特性。

转载于:https://www.cnblogs.com/wangdaniu/archive/2006/08/25/486258.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值