Windows Family of Operating Systems




Дата канвертавання19.04.2016
Памер26.18 Kb.


Windows Platform Design Notes

Designing Hardware for the Microsoft Windows Family of Operating Systems

Point Sprite Implementation in Microsoft DirectX 8



Abstract: Point sprites are a new feature in Microsoft® DirectX® 8 APIs. DirectX 8 defines a point sprite as a textured point with texture co-ordinates 0,0 in the top left corner and 1,1 in the bottom right corner. Driver developers can use this information to correctly implement point sprite capabilities included in DirectX 8.

The information in this white paper refers to the Microsoft Windows XP operating system and later versions. This white paper is a supplement to the Point Sprite section and ReadMe of the DirectX information in the Windows Driver Development Kit (DDK) and the Microsoft Platform Software Development Kit (SDK). This document assumes that the reader is familiar with the related DDK and SDK information.



Draft Version 0.7— March 3, 2001

Contents

Introduction 2

FAQ for point sprites and DirectX 8 3

Call to Action for Point Sprite Support in DirectX 8 4


Disclaimer: 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. This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT.

Microsoft Corporation may have patents or pending patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. The furnishing of this document does not give you any license to the patents, trademarks, copyrights, or other intellectual property rights except as expressly provided in any written license agreement from Microsoft Corporation.

Microsoft does not make any representation or warranty regarding specifications in this document or any product or item developed based on these specifications. Microsoft disclaims all express and implied warranties, including but not limited to the implied warranties or mer­chantability, Fitness for a particular purpose and freedom from infringement. Without limiting the generality of the foregoing, Microsoft does not make any warranty of any kind that any item developed based on these specifications, or any portion of a specification, will not infringe any copyright, patent, trade secret or other intellectual property right of any person or entity in any country. It is your responsibility to seek licenses for such intellectual property rights where appropriate. Microsoft shall not be liable for any damages arising out of or in connection with the use of these specifications, including liability for lost profit, business interruption, or any other damages whatsoever. Some states do not allow the exclusion or limitation of liability or consequential or incidental damages; the above limitation may not apply to you.

Microsoft, Direct3D, DirectX, Win32, Windows, and Windows NT are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners.

© 2001 Microsoft Corporation. All rights reserved.

Introduction


This paper discusses point sprites, a new feature of DirectX 8 for Windows XP and later releases. Point sprites, as defined by DirectX 8, are points that are textured using the texture co-ordinate generation method described in the “Point Rendering” section of the DirectX 8 SDK. This texture-generation method is disabled and enabled using the point sprite enable render state (D3DRS_POINTSPRITEENABLE).

With the release of DirectX 8, points now have an inherent size. By default, point size is 1.0; therefore, a single pixel is drawn for each vertex.

In earlier versions of DirectX, there was no way to set the point size. With DirectX 8, the software or driver developer now has the ability to set the point size in two ways:


  • The point size render state (D3DRS_POINTSIZE)

  • As a size value contained in a Flexible Vertex Format (FVF) vertex, as described in the Windows Millennium (Windows Me) DDK


Point size render state. In DirectX 8, the size of a point sprite can be specified either by a new per-vertex element or by a new render state. If the driver and hardware combination supports the interleaving of point size information with other vertex data—rather than simply through the point size render state D3DRS_POINTSIZE—the driver should set the D3DFVFCAPS_PSIZE flag in the FVFCaps field of the D3DCAPS8 structure.

The absence of D3DFVFCAPS_PSIZE indicates that the device does not support D3DFVF_PSIZE (per-vertex point size) for pre-transformed vertices; thus, the base point size will always come from D3DRS_POINTSIZE). D3DFVF_PSIZE is always supported for post-transformed vertices.

If DirectX 8 drivers have not set the D3DFVFCAPS_PSIZE bit, they are required to accept D3DFVF_PSIZE for post-transformed vertices. This ability may be emulated in the runtime for non-transformed points if software vertex processing is used.

The D3DUSAGE_POINTS bit must be set for vertex buffers that will be used for rendering point sprites. This is done so that the driver can avoid allocating these vertex buffers in memory types that are slow for reads into the CPU.

For more information, see “Point Sprite” in the Windows XP DDK.

Important Notes:


  • Point sprites must not have any dependencies on the culling or fill modes.

Point sprites should always be rendered, regardless of the cull or fill mode. Even when the point sprite-enable render state is turned off, points can still be rendered with a size greater than 1.0. However, points rendered with a size greater than 1.0 are not point sprites under DirectX 8.

  • The DirectX rule for flat shading of a primitive must be followed in point fill mode.

Although this rule is not directly related to point sprites, it is related to point size, and is an issue for driver manufactures when they add point sprite functionality. The first vertex of a triangle dictates the color of that triangle, and therefore, the color for each vertex of the triangle. This is not what occurs with the DirectX 8 version of the reference rasterizer, but the behavior will be changed in later versions of DirectX.

  • Check the MaxPointSize and D3DFVFCAPS_PSIZE capability flags for hardware vertex processing.

When using software vertex processing in DirectX 8b and later versions, you will have complete point sprite functionality and a MaxPointSize of at least 16. In these versions, it will be even more important to check both these capability bits for hardware vertex processing. Point size and sprite functionality will not always be supported.

FAQ for point sprites and DirectX 8


  1. When do I use the FVF capability flag (cap) D3DFVFCAPS_PSIZE?

The FVF capability flag is set by the driver and allows a device to specify that it does not support point size data in FVF vertex data. However, the Windows XP Hardware Compatibility Tests (HCTs) checks to verify that any point size data passed in FVF data to the driver be gracefully ignored.

See “Reporting Support for Point Sprites” in the Windows DDK.



  1. If I do not want to support point sprite functionality for my hardware, what capability bits must I set?

The MaxPointSize capability must be set to 1.0f. This setting indicates that your hardware is not capable of rendering point sprites.

  1. If I expose a Transform and Lighting (TNL) HAL to offer hardware vertex processing and support point sprites in hardware, what are my responsibilities?

In this case, the driver is entirely responsible for a correct point sprite implementation. No emulation will be performed by the DirectX runtime. This includes hardware used with software vertex processing; enabled point sprites are the driver's responsibility.

There is one exception to this rule: If D3DFVFCAPS_PSIZE is set to false, the functionality that this capability bit specifies will be emulated in software vertex procession modes.



  1. How do I know when the DirectX software no longer wants to draw point sprites and simply wants to draw single pixel points?

For the software application to switch to drawing single pixel vertices, the device that supports DirectX 8 must set the following render states:

//This turns off any point attenuation See SDK documentation

SetRenderState (D3DRS_POINTSCALEENABLE, FALSE)

//All textures must be turned off.

SetTexture (0, NULL);

SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);

//The render state point size must be set to any value between 0.0-1.0;

SetRenderState(D3DRS_POINTSIZE, 1.0);

//NB: This is for the API users D3DRS_POINTSIZE_MIN and

//D3DRS_POINTSIZE_MAX must be set appropriately to allow

//D3DRS_POINTSIZE to be set to a value between 0.0-1.0


  1. How do I render point sprites when the vertex data contains no texture co-ordinates?

  • True for D3DRS_POINTSPRITENABLE

The texture co-ordinates for the corners of the point sprite should be generated as follows, starting from the top left corner and proceeding clockwise:

(0.0f, 0.0f)
(1.0f, 0.0f)
(0.0f, 1.0f)
(1.0f, 1.0f)


  • False for D3DRS_POINTSPRITENABLE

The texture co-ordinates should be set to the defaults at each corner of the sprite:
(0.0f, 0.0f, 0.0f, 1.0f)

See “Rendering Point Sprites” in the Windows DDK.


Call to Action for Point Sprite Support in DirectX 8


  • Meet the "Designed for Windows" Logo Program requirements for DirectX support:

If hardware acceleration for any DirectX 8 features is implemented, the features must be supported as defined in DirectX DDK and the DirectX SDK.

For complete information, see Windows Logo Program Requirements, Version 2.0, which is available at http://www.microsoft.com/hwdev/winlogo/.



  • If your hardware support point sprite functionality, test that your drivers provide full support using the PointSprite.exe test.

This test is part of the Display Compatibility Test (DCT) 400 and later test kits, provided with the Windows HCT from WHQL. DCT 400 and later versions check for the correct implementation of point sprites in drivers for all hardware that implements support for Microsoft Direct3D® APIs.

Information about obtaining the beta versions of the Windows XP HCT is provided on the WHQL web site at http://www.microsoft.com/hwdev/.



Testing early will help you develop products optimized for Windows XP, and it helps Microsoft identify and resolve issues before the final release of the DCTs.

  • Study the “Point Sprites” section and the ReadMe file of the Windows DDK, and the Microsoft Platform SDK.

The Microsoft Platform SDK is provided through MSDN Professional subscription, and is available on the web at http://msdn.microsoft.com/library/default.asp. The Windows DDK can be obtained from the web site at http://www.microsoft.com/ddk/. The beta DDK is provided with the Beta release of Windows XP.



База данных защищена авторским правом ©shkola.of.by 2016
звярнуцца да адміністрацыі

    Галоўная старонка