Table of contents
GDI
TOC
Collapse the table of content
Expand the table of content

Supporting High-Order Patched Surfaces

Last Updated: 2/14/2017

A DirectX 9.0 version driver for a device that supports adaptive tessellation and displacement mapping for high-order patched surfaces must indicate such support with capability bits and be able to process new adaptive-tessellation render states and a displacement-map texture stage state. For more information about adaptive tessellation and displacement mapping, see the latest DirectX SDK.

To indicate support of adaptive tessellation and displacement mapping, the driver sets the following capability bits in the DevCaps2 member of the D3DCAPS9 structure:

D3DDEVCAPS2_ADAPTIVETESSRTPATCH
Device can adaptively tessellate render-target patches.

D3DDEVCAPS2_ADAPTIVETESSNPATCH
Device can adaptively tessellate N-patches.

D3DDEVCAPS2_DMAPNPATCH
Device supports displacement maps for N-patches.

D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH
Device supports presampled displacement maps for N-patches.

To indicate the maximum number of N-patch subdivisions that the display device can support, the driver sets the MaxNpatchTessellationLevel member of the D3DCAPS9 structure to the maximum number. Applications that use presampled displacement mapping are affected by the device clamping to this maximum number.

The driver returns a D3DCAPS9 structure in response to a GetDriverInfo2 query similarly to how it returns a D3DCAPS8 structure as described in Reporting DirectX 8.0 Style Direct3D Capabilities. Support of this query is described in Supporting GetDriverInfo2.

The driver specifies the D3DFORMAT_OP_DMAP flag in the dwOperations member of the DDPIXELFORMAT structure for a particular surface format to mark the format for displacement-map sampling. When a texture surface is created, the Direct3D runtime sets the DDSCAPS3_DMAP bit of the dwCaps3 member of the DDSCAPSEX (DDSCAPS2) structure to indicate that the texture can be sampled in the tessellation unit.

Note that DirectX 9.0 and later drivers must turn off the N-patch feature only when the value of the D3DRS_PATCHSEGMENTS render state is less than 1.0f. DirectX 8.1 and earlier drivers are not required to behave in this manner.

The following adaptive-tessellation render states along with their default values are new for DirectX 9.0:

D3DRS_MAXTESSELLATIONLEVEL = 1.0f

D3DRS_MINTESSELLATIONLEVEL = 1.0f

D3DRS_ADAPTIVETESS_X = 0.0f

D3DRS_ADAPTIVETESS_Y = 0.0f

D3DRS_ADAPTIVETESS_Z = 1.0f

D3DRS_ADAPTIVETESS_W = 0.0f

D3DRS_ENABLEADAPTIVETESSELLATION = FALSE

The D3DDMAPSAMPLER sampler, which is also new for DirectX 9.0, is used in the tessellation unit to set a displacement map texture.

Note DirectX 9.0 and later applications can use the D3DSAMP_DMAPOFFSET value in the D3DSAMPLERSTATETYPE enumeration to control the offset, in vertices, into the presampled displacement map. The runtime maps user-mode sampler states (D3DSAMP_Xxx) to kernel-mode D3DTSS_Xxx values so that DirectX 9.0 and later drivers are not required to process user-mode sampler states. Therefore, drivers must instead process the D3DTSS_DMAPOFFSET value in the TSState member of the D3DHAL_DP2TEXTURESTAGESTATE structure for D3DDP2OP_TEXTURESTAGESTATE operations. For more information about D3DSAMPLERSTATETYPE and presampled displacement mapping, see the latest DirectX SDK documentation.

Send comments about this topic to Microsoft

© 2017 Microsoft