High-Fidelity Graphics with DirectX

High-Fidelity Graphics with DirectX
Windows application developers have long used DirectX® to provide high-quality, hardware-accelerated, 3D graphics. When the technology debuted in 1995, developers could provide high-quality 3D graphics for games and engineering applications for gamers and professionals willing to pay extra for a 3D-graphics board. Now, even the most inexpensive PCs include capable 3D-graphics hardware.
To take advantage of these graphics capabilities, Windows Vista introduced the Windows Display Driver Model (WDDM) infrastructure for DirectX that enabled multiple applications and services to share the resources of the GPU. The Desktop Window Manager (DWM) uses this technology to animate task switching in 3D, provide dynamic thumbnail images of application windows, and to provide Windows® Aero® glass effects for desktop applications.
Windows 7 puts even more graphics capability into the hands of application developers. Through a new set of DirectX APIs, Win32 developers can take advantage of the latest innovations in GPUs to add fast, scalable, high-quality, 2D and 3D graphics, text, and images to their applications. On the latest LCD displays, DirectX APIs can display desktop and window content using color depth greater than 8 bits per color component.
With DirectX, Win32 developers can also use the GPU’s parallelism for general-purpose computation such as image processing, and can render to DirectX 10 hardware, DirectX 9 hardware, the CPU, or to a remote Windows computer. These technologies were designed to interoperate with GDI and GDI+, ensuring that developers can easily preserve their existing investments in Win32 code.
These enhanced graphics capabilities are provided by the following COM-based APIs:
Direct2D for drawing 2D graphics.
DirectWrite for arranging and rendering text.
Windows Imaging Component for processing and displaying images.
Direct3D® 10 for drawing 3D graphics.
Direct3D 11 for drawing 3D graphics, and providing access to next-generation GPU technologies, such as tessellation, limited support for texture streaming, and general purpose computing.
DirectX Graphics Infrastructure (DXGI) for managing devices and GPU resources, and providing interoperability between DirectX and GDI.
Direct2D
Built on Direct3D 10, Direct2D offers Win32 developers immediate-mode, resolution-independent, 2D APIs that use the power of next-generation graphics hardware, yet interoperate well with today’s GDI/GDI+ applications and Direct3D 10 applications. Direct2D provides high-quality 2D rendering with performance superior to GDI and GDI+. It provides Win32 developers finer control over resources and their management.
DirectWrite
Many of today’s applications need to support high-quality text rendering, resolution-independent outline fonts, and full Unicode text and layout support. DirectWrite, a new DirectX component, provides these features and more:
A device-independent text layout system that improves text readability in documents and in UI.
High-quality, sub-pixel, ClearType® text rendering that can use GDI, Direct2D, or application-specific rendering technology.
Hardware-accelerated text, when used with Direct2D.
Support for multi-format text.
Support for the advanced typography features of OpenType® fonts.
Support for the layout and rendering of text in all supported languages.
GDI-compatible layout and rendering.
The DirectWrite font system enables ”any font anywhere” font usage, where users don’t have to perform a separate installation step just to use a font, and an improved structural hierarchy of font grouping to help with manual or programmatic font discovery. The APIs support measuring, drawing, and hit-testing of multi-format text. DirectWrite handles text in all supported languages for global and localized applications, building on the key language infrastructure found in Windows 7. DirectWrite also provides low-level glyph rendering APIs for developers who want to perform their own layout and Unicode-to-glyph processing.
Windows Imaging Component
In Windows Vista, the Windows Imaging Component introduced an extensible framework for working with images and image metadata. The image formats supported by Windows Imaging Component include JPEG, PNG, and TIFF, and the supported metadata formats include XMP and EXIF. With Windows 7, Windows Imaging Component broadens its standards compliance by providing support for progressive image decoding, expanded PNG features, GIF metadata, and metadata that spans APPn segments.
Direct3D 11
Direct3D 11 extends the functionality of the Direct3D 10 pipeline and provides Windows 7 games and high-end 3D applications with efficient, robust, scalable access to the upcoming generation of GPUs and multi-core CPUs. In addition to the functionality found in Direct3D 10, Direct3D 11 introduces several new features.
Geometry and high-order surfaces can now be tessellated to support scalable, dynamic content in patch and subdivision surface representations.
To make good use of the parallel processing power available from multiple CPU cores, multithreading increases the number of potential rendering calls per frame by distributing the application, runtime, and driver calls across multiple cores. In addition, resource creation and management has been optimized for multithreaded use, enabling more efficient dynamic texture management for streaming.
New general-purpose compute shaders have been created for Direct3D 11. Unlike existing shaders, these are extensions to the programmable pipeline that enable your application to do more work completely on the GPU, independent of the CPU. DrawAuto, which was introduced in Direct3D 10, has been extended to interact with a compute shader.
Several improvements have been made to the high-level shading language (HLSL), such as a limited form of dynamic linkage in shaders to improve specialization complexity, and object-oriented programming constructs like classes and interfaces.
Direct3D 10 improvements
Direct3D 10 includes a redesigned graphics pipeline with programmable shader stages and immutable state objects for initializing the fixed-function stages. The state objects simplify the pipeline and improve performance by minimizing the number of state changes required. Programmability of shader stages now offers high-level shading language extensions to support unlimited shader instructions, generalized shader resources, and integer and bitwise calculations.
The pipeline also introduces the geometry shader stage, which offloads work entirely from the CPU to the GPU. This new stage enables you to create geometry, stream the data to memory, and render the geometry with no CPU interaction.
Several other improvements are designed specifically for faster performance. Predicated rendering performs occlusion culling to reduce the amount of geometry that is rendered. Instancing APIs can dramatically reduce the amount of geometry that needs to be transferred to the GPU by drawing multiple-instances of similar objects. Texture arrays enable the GPU to do texture swapping without CPU intervention.
Several additions have been made to Direct3D 10 and Direct3D 11 to extend the gamut of configurations that can be targeted with these APIs. The Windows Advanced Rasterization Platform (WARP) implements fast, multi-core scalable CPU rendering for Direct3D 10, enabling full-featured graphics rendering on systems without graphics hardware. The addition of new “Feature Levels,” specifically called Direct3D 10 Level 9, allow the Direct3D 10 and Direct3D 11 APIs to drive Direct3D 9-class hardware, expanding the number of configurations a Direct3D 10 or Direct3D 11 application can target to nearly every computer system on the market.
DirectX/GDI Interoperability
In Windows Vista, the behavior of an application that uses both DirectX and GDI to render to a shared surface is different depending on whether Desktop Window Manager (DWM) is on or off. In addition, when DWM is on, applications that use both DirectX and GDI behave differently on Windows Vista than on Windows XP. This caused many ISVs to disable DWM when running their applications on Windows Vista to ensure consistent behavior. With the improvements to DirectX in Windows 7, an application can now freely mix DirectX and GDI without disabling DWM. Windows 7 also features improved performance for scenarios that require interoperation between DirectX and GDI by utilizing the more efficient Direct3D 10 APIs.
Media Platform
Media Foundation and DirectShow® provide the basis for media support in Windows. Media Foundation was introduced in Windows Vista as the replacement for DirectShow. In Windows 7, Media Foundation has been enhanced to provide better format support, including MPEG-4, as well as support for video capture devices and hardware codecs.
Format Support
In Windows 7, Media Foundation provides extensive format support that includes codecs for H.264 video, MJPEG, and MP3; new sources for MP4, 3GP, MPEG2-TS, and AVI; and new file sinks for MP4, 3GP, and MP3.
In addition, a new DirectShow wrapper source provides a bridge between DirectShow and Media Foundation. With it, a Media Foundation application can play older media formats that lack native Media Foundation support.
Hardware Devices
Media Foundation now supports the following types of hardware devices in the audio/video pipeline:
UVC 1.1 video capture devices, such as webcams
Audio capture devices
Hardware encoders and decoders
Hardware video processors, such as color-space converters
Hardware codecs can perform very fast video transcoding. For example, suppose you want to transfer a Windows Media Video (WMV) file to a cell phone that supports only 3GP files. With a hardware encoder, the file can be transcoded "as needed," immediately before transferring it to the device. Hardware codecs also provide a more secure environment for implementing content protection schemes, so that premium content can be viewed on the PC.
Hardware devices are represented in Media Foundation by a proxy object, and are used in the pipeline just like software-based components.
Simplified Programming Model
In Windows Vista, Media Foundation exposed a relatively low-level set of APIs. These APIs are flexible, but may not be appropriate for performing tasks. Windows 7 adds new high-level APIs that make it simpler to write media applications in C++. These new high-level APIs include:
MFPlay. These APIs are designed for audio and video playback. They support the typical playback operations (stop, pause, play, seek, rate control, audio volume, and so forth), while hiding the details of the low-level APIs (the session and topology layers).
Source Reader. You can use these APIs to pull raw or decoded data from a media file, without knowing anything about the underlying format. For example, you can get a thumbnail bitmap from a video file or get live video frames from a webcam.
Sink Writer. You can use these APIs to author media files by passing in uncompressed or encoded data. For example, you can re-encode or remix a video file.
Transcode. The Transcode APIs target the most common audio and video encoding scenarios.
Platform Improvements
Windows 7 includes numerous enhancements to the underlying Media Foundation platform APIs. Advanced applications can use these APIs directly; other applications will get the benefits indirectly. These benefits include:
Improvements in the video pipeline to reduce power consumption and video memory usage.
New DVXA video processing APIs, which use a more flexible compositing model and are better suited for HD video formats.
Improvements to the way in which plug-ins (sources and decoders) are enumerated and managed.
|