Windows Platform Design Notes Design Information for the Microsoft ® Windows® Family of Operating Systems Binary Surface Support and Image Filtering Abstract This paper describes binary surface and image filtering support that is planned for Microsoft® Windows® Vista™. In addition to discussing planned operating system support for hardware acceleration of high-quality text and images, this paper also includes recommendations for polygon antialiasing. Contents Introduction............................................................................................................................................. 3 Binary Surface Support ........................................................................................................................... 3 Baseline Usage Scenario .................................................................................................................. 3 Extended Usage Scenario ................................................................................................................. 3 Definitions ......................................................................................................................................... 4 Monochrome Surface Format Filtering............................................................................................... 4 Image Filtering........................................................................................................................................ 6 Requirements .................................................................................................................................... 6 API .................................................................................................................................................... 6 Combination ...................................................................................................................................... 6 Text Rendering in Windows Vista ........................................................................................................... 7 Antialiasing ............................................................................................................................................. 9 Windows Logo Program Issues ............................................................................................................ 10 Call to Action and Resources ................................................................................................................ 10 Binary Surface Support and Image Filtering - 2 The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. © 2003 Microsoft Corporation. All rights reserved. Microsoft, DirectX, PowerPoint, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. © 2003 Microsoft Corporation. All rights reserved. Binary Surface Support and Image Filtering - 3 Introduction As part of the new client platform, Microsoft® Windows® Vista provides binary surface support and image filtering for hardware acceleration of text and images. Hardware acceleration of text and images enables capabilities for applications such as: High-quality text, both static and animated. The Windows Vista client platform uses Microsoft® DirectX® for all screen display, so these features enable video drivers to improve the on-screen display performance of text, particularly the initial display of a new screen. High-quality filtering for image processing effects. Image filtering supports image scaling for presentation by applications such as Microsoft® PowerPoint®, Windows user interface (UI), and thumbnail views, as well as rescaling content in legacy UI windows to the larger sizes that are needed for high-DPI (dots per inch) displays or transition animations. This paper describes the binary surface and image filtering support that is planned for Windows Vista, including recommendations for polygon antialiasing. Binary Surface Support A binary 1-bit surface format is primarily used in various methods for rendering various qualities of antialiased text. The binary surface format is referred to as: D3DFMT_A1 Baseline Usage Scenario The baseline usage scenario requires binary surface creation and filtering. 1. The application creates and maintains a list of text runs, spans, or tiles as texture data. 2. The application composites span into their destination by using high-quality filters on texture read, pixel shaders, and the transparent or alpha FB blender. Note: This scenario is also used for hardware that cannot support binary surfaces through a different algorithm that uses an A8 pixel format, in which case the application code performs the filtering. Extended Usage Scenario The extended usage scenario requires binary surface creation, filtering, composition, and glyph cache loading, as defined later in this paper. 1. The application uploads a cache that contains approximately 2 K of common font characters in video memory at typically less than 120x150 pixels (~2 KB) for each character, for an approximate total of 4 MB. 2. The application sends a 1-bit surface (typically ~8000x150 bits), with some bits set for each span. © 2003 Microsoft Corporation. All rights reserved. Binary Surface Support and Image Filtering - 4 3. Using hardware, the application composites into the surface some of the cached bit-image character tiles, leaving the resulting 4000x150 surface in video memory for texturing. 4. The application composites the spans into the destination surface by using high-quality filters on texture read, pixel shaders, and the transparent or alpha FB blender. Definitions Binary Surface Creation Alignment constraints that are finer than DWORD are not required. For example, pitch can be a multiple of 32 bits, DWORD-aligned. The size should be at least 4K bits horizontally, but 8K 1-bit texels are preferred. Glyph Cache Loading A font cache load device-driver interface (DDI) is a DP2 token with a list of characters that are defined as follows: A 16-bit glyph ID and a surface of bits. A loading font cache that will take the bits + header of 16-bit glyph handle + dimensions. Binary Surface Compositing Binary surface compositing means to OR the bits together or to render, write, and company them by using the 0.5 alpha test. Therefore, an A1 format must be able to be a render target or a compositing blt destination. The DDI for this will be a DP2 token, probably related to the DirectX 9-blt token, followed by a list of characters that are defined by a 16-bit glyph handle + x step and y offset. State changes should not be an issue because most state can be ignored during this specific compositing operation. Note: If separate vertex data must be transmitted to the chip for each glyph, performing this step in hardware is unlikely to provide any benefit. Monochrome Surface Format Filtering Monochrome surface format filtering uses filters for sampling the single-channel binary surface format. The minimum bar filter for this data type is defined as follows: It has application programming interface (API)-programmable weights, but only a subset of the matrix weights are provided through the API because the data type can be symmetric and separable. The other elements can be generated by replicating and multiplying. © 2003 Microsoft Corporation. All rights reserved. Binary Surface Support and Image Filtering - 5 Each axis (vertical and horizontal) receives a separate weight profile across the API from the application code. The kernel contents are updated no more than once for each string rendered. The range of weights is 0.0 to 1.0. No negative weights are required for binary data. The weights must have at least 6-bit precision. At least 3 bits of phase (for 1/8 of subpixel resolution) are required. No gamma correction is required for reads that use this format and this filter. The required minimum bar is a 6x5 filter. The 6x5 filter is defined as follows: x x x x x x x x x x x x x x x 5 4 1 x x x x 2 x x x x 3 x x The API specifies only these five numbers for the 6x5 case. If the implementation requires power-of-2 dimensions for this filter kernel, then 7x7 or 8x8 are acceptable sizes. Where: Ti,j are texture map samples. The centers of the texture samples are located at integer coordinates. Ch[6] are filter kernel weights in the horizontal (u) direction. Cv[5] are filter kernel weights in the vertical (v) direction. β is the fraction of the position of the filter kernel center in the u direction (0 <= β < 1). α is the fraction of the position of the filter kernel center in the v direction (0 <= α < 1). Logically, the implementation must sample a total of 7x6 texels, interpolate them according to the subpixel positioning down to 6x5 samples, and then apply the corresponding 6x5 array of app-specified weights before summing. The API and DDI use current D3D texture sampling and rendering syntax with new D3DTSS tokens to specify filter weights. Note: Hardware must support this binary format filter for at least three of the texture stages, plus one RGBA8 texture on a fourth stage, plus 12 instructions for blending the results in a single pass. © 2003 Microsoft Corporation. All rights reserved. Binary Surface Support and Image Filtering - 6 Reuse of two or more of the four stages to filter a single 1-bit texture is not allowed. Multimission Interactive Picture (MIP) mapping/trilinear can require twice the stage count if needed, but this is not recommended. It is not required to support full 2.0-pixel shader functionality in conjunction with this filtering support, but 2.0-pixel shader support is recommended in all future hardware. Image Filtering Image filtering improves image quality for imaging applications such as Microsoft PowerPoint. Image filtering also improves image quality for the desktop browser shell and image processing algorithms. Requirements Image filter formats must meet the following requirements: 2- to 4-channel 8- or 10-bit integers. A 4x4 polyphase with at least 5 bits or 32 levels of subpixel phase. Programmable weights of at least 8-bit precision. A range of weights from -1.0 to 2.0 to support negative lobes. Assumed symmetric and separable type. API Image filtering APIs were exposed in DirectX 9 as the atomic PYRAMIDALQUAD and GAUSSIANQUAD filter modes. In this API release, the weights are precomputed in software. Interfaces for loading coefficients directly from the API are being considered. Image-filtering APIs enable image manipulation applications that interact with programmable kernels to compute gradients and other image effects. If implemented, this feature should not consume resources from the minimum baseline of any shader model that is exposed by the implementation. Combination Implementations can combine these requirements and deliver a single filtering capability that meets the minimum requirement levels of both image and text filtering. For example, this would imply: A 6x5 filter with programmable weights. Subpixel positioning to 5 bits (not 8). Higher order interpolation of filter weights (not just linear). A dynamic range of -1.0 to 2.0 for weights. Weights with >=8 bits precision per component and 4x4 asymmetric weights or 7x7 symmetric weights. © 2003 Microsoft Corporation. All rights reserved. Binary Surface Support and Image Filtering - 7 Text Rendering in Windows Vista The following figures summarize the process of text rendering in Windows Vista. Font Cache CMILGlyphRun CMILRealizedFontFaceId CMILRenderContext CGlyphRunMaker Overscaled 1bpp glyph run image Filtering Overscaled 8bpp filtered data HW branch: SW branch: Done Splitting to subglyphs Placing in tanks Glyph Bank: 32bpp A8R8G8B8 Glyph Run Data Preparation Filtered Data SW painter Other source data: Positioning Clipping Modes: Clear type / grey scale Gamma correction level Rendering routines - 16 for now: Gamma / no gamma Solid brush / gradient Shift only / arbitrary transformation Clear type / grey scale Render Target Bitmap Software Rendering © 2003 Microsoft Corporation. All rights reserved. Binary Surface Support and Image Filtering - 8 Filtered Data: D3DFMT_A8R8G8B8 From glyph bank Other source data: positioning, modes HW painter Texture stage chain based 4 branches: Clear type / grey scale Solid brush / textured (including gradient) NO GAMMA Pixel shaderbased: Disabled by default for now Branches: Solid brush Textured brush Solid brush + gamma HW output rasterizer: linear blending only Target Surface Hardware Rendering Solid brush Color with alpha Vertex buffer Stage 0 HW rasterizer Glyph bank Alpha, bilinear interpolated Textured brush Color with alpha Brush texture Stage 0 Glyph bank Stage 1 Clear type /grey scale: affects HW rasterizer only. Clear type is made in three passes, one for each color component. Requires: D3DRS_COLORWRITEENABLE Hardware Rendering: Texture Stage Chain Based © 2003 Microsoft Corporation. All rights reserved. HW rasterizer Binary Surface Support and Image Filtering - 9 Goals: Clear type solid brush rendering in 1 pass Clear type textured brush rendering in 2 passes Linear-cubic gamma ratios Gamma correction available Solid brush Sampler 0 Glyph bank Pixel shader Sampler 1 Sampler 2 Brush color HW rasterizer Requires: D3DPBLENDCAPS_BLENDFACTOR Hardware Rendering: Pixel Shader Based Purpose: improve performance for different scenarios: • one - time touch • editing • animation Temporary tank Rulers: Stubification Persistent tanks Loose load eviction Constrained VM eviction Hardware Glyph Caching: Glyph Bank Antialiasing For hardware to keep pace with software quality, a polygon antialiasing scheme is necessary for structured graphics data. Polygon antialiasing in hardware: Should enable at least 4x4 (16-sample) quality levels. Must not consume 16x memory because high-DPI and 10-bit or 16-bit color components will be needed at the same time. Must be able to be enabled or disabled on a per-call basis so that some objects can be rendered aliased if desired. Scenes that use polygon antialiasing are likely to be fairly simple, with no depth buffer involved. The number of edges in such scenes is likely to be relatively small, making AA schemes that require processing every pixel in the scene too expensive in memory requirements. © 2003 Microsoft Corporation. All rights reserved. Binary Surface Support and Image Filtering - 10 Windows Logo Program Issues Proposed requirements for the Designed for Windows Logo Program for binary surface, Image Filtering and anti-aliasing will be in later drafts (starting with draft .07) of the Windows Logo Program System and Device Requirements, Version 3.0. For related hardware specific proposed requirements, see draft .04 of the Windows Logo Program System and Device Requirements, Version 3.0 included on the WinHEC CD or at http://www.microsoft.com/winlogo/hardware/HWrequirements.mspx. Call to Action and Resources Call to Action: For device manufacturers: Implement fixed function support for creating, composing, and filtering a 1-bit surface format as defined above. For driver developers: Implement support for these features to be used in developing silicon supporting them until the final API is defined. For questions about this technology or any other issues with hardware accelerator rendering, send e-mail to directX@microsoft.com. Resources: Designed for Microsoft Windows XP Application Specification http://www.microsoft.com/winlogo/software/windowsxp-sw.mspx Microsoft Hardware and Driver Developer Information http://www.microsoft.com/hwdev/ Microsoft Platform Software Development Kit (SDK) http://msdn.microsoft.com/downloads/ Microsoft Windows Driver Development Kit (DDK) http://www.microsoft.com/ddk/ Microsoft Windows Logo Program System and Device Requirements, Version 3.0, draft 0.04 http://www.microsoft.com/winlogo/hardware/HWrequirements.mspx Windows XP Application Compatibility Toolkit http://msdn.microsoft.com/compatibility/ Microsoft Windows XP Hardware Compatibility Test Kit, Version 11.2 http://www.microsoft.com/hwtest/ © 2003 Microsoft Corporation. All rights reserved.