共用方式為


Hardware Transform and Lighting

Hardware acceleration of geometry operations, such as lighting and transformation, has been enabled with modifications to the D3dDrawPrimitives2 DDI for the latest Direct X release. At the API level, devices that support vertex operations in hardware are enumerated separately from those that do rasterization only.

The existing caps structures have been extended to indicate features that may be present on a hardware-accelerated transform device. For example, the number of supported light sources is set with the dwNumLights member of the D3DLIGHTINGCAPS structure that is reported with the D3DDEVICEDESC_V1 structure.

Other flags are listed in the following table:

Flag Meaning

D3DDEVCAPS_CANBLTSYSTONONLOCAL

The device supports a texture blt from system memory to nonlocal video memory.

D3DDEVCAPS_DRAWPRIMITIVES2EX

The driver is DirectX 7.0-compliant by supporting extended D3dDrawPrimitives2 capabilities.

D3DDEVCAPS_HWRASTERIZATION

The device has hardware acceleration for rasterization.

D3DDEVCAPS_HWTRANSFORMANDLIGHT

The device can support both hardware transform and lighting in hardware.

D3DDEVCAPS_SEPARATETEXTUREMEMORIES

The device is texturing from separate memory pools.

D3DTRANSFORMCAPS_CLIP

The hardware can clip while transforming.

Because the feature sets of hardware geometry accelerators may differ (such as the number of light sources supported), the caps structures indicate which subset of geometry operations this device performs. Zero is a valid value for the number of light sources supported, indicating that the hardware does transformations only.

Only vertices that include a vertex normal are properly lit; for vertices that do not contain a normal, a dot product of 0 is employed in all lighting calculations.

All the key state and data structures used by the software implementation of the geometry pipeline are made available at the DDI level. Some display cards only implement lighting in the hardware, and do transformation and clipping on the host processor.

The following render state types pertain only to devices that accelerate transform and lighting:

D3DRENDERSTATE_AMBIENT
D3DRENDERSTATE_AMBIENTMATERIALSOURCE
D3DRENDERSTATE_CLIPPING
D3DRENDERSTATE_CLIPPLANEENABLE
D3DRENDERSTATE_COLORVERTEX
D3DRENDERSTATE_DIFFUSEMATERIALSOURCE
D3DRENDERSTATE_EMISSIVEMATERIALSOURCE
D3DRENDERSTATE_EXTENTS
D3DRENDERSTATE_FOGVERTEXMODE
D3DRENDERSTATE_LIGHTING
D3DRENDERSTATE_LOCALVIEWER
D3DRENDERSTATE_NORMALIZENORMALS
D3DRENDERSTATE_SPECULARMATERIALSOURCE
D3DRENDERSTATE_VERTEXBLEND