Share via


Direct3D Driver Initialization

When the driver's HALInit function is called by the DirectDraw run time to initialize DirectDraw support, the driver must do the following to indicate its Direct3D capabilities:

  • Set the DDCAPS_3D flag in the ddCaps.dwCaps member of the DDHALINFO structure to indicate that the driver's hardware has 3D acceleration.

  • Set any of the following DDSCAPS_xxx flags in the ddCaps.ddCaps member of the DDHALINFO structure that describes the 3D capabilities of a driver's video memory surface.

    Flag Description
    DDSCAPS_3DDEVICE Indicates that a driver's surface can be used as a destination for 3D rendering.
    DDSCAPS_TEXTURE Indicates that a driver's surface can be used for 3D texture mapping.
    DDSCAPS_ZBUFFER Indicates that a driver's surface can be used as a Z-buffer.
  • Set the GetDriverInfo member of the DDHALINFO structure to point to the driver's GetDriverInfo callback. The driver must also set the DDHALINFO_GETDRIVERINFOSET flag in the dwFlags member of the DDHALINFO structure to indicate that it has implemented the GetDriverInfo callback.

  • Allocate and initialize the members of the D3DHAL_CALLBACKS structure and return this structure in the lpD3DHALCallbacks member of the DDHALINFO structure.

  • Allocate and initialize the members of the D3DHAL_GLOBALDRIVERDATA structure and return this structure in the lpD3DGlobalDriverData member of the DDHALINFO structure.

  • Include the D3DDEVCAPS_DRAWPRIMITIVES2EX flag in the devCaps member of the D3DDEVICEDESC_V1 structure that is reported during Direct3D driver initialization.

  • Respond to the GUID_Miscellaneous2Callbacks GUID in GetDriverInfo callback by setting the GetDriverState, CreateSurfaceEx, and DestroyDDLocal members of the DDHAL_DDMISCELLANEOUS2CALLBACKS structure. These are set to point to the appropriate callbacks for the Direct3D driver and are used to perform an OR operation with the dwFlags member with the DDHAL_MISC2CB32_CREATESURFACEEX, DDHAL_MISC2CB32_GETDRIVERSTATE and DDHAL_MISC2CB32_DESTROYDDLOCAL bits, respectively.

After HALInit returns, DirectDraw calls the driver's GetDriverInfo callback several times for different GUIDs to complete the driver's initialization. To support Direct3D, the GetDriverInfo callback must respond to the following GUIDs:

  • GUID_D3DCallbacks3
    The driver should allocate and initialize the members of the D3DHAL_CALLBACKS3 structure and return this structure in the lpvData member of the DDHAL_GETDRIVERINFODATA structure.
  • GUID_Miscellaneous2Callbacks
    The driver should allocate and initialize the members of the DDHAL_DDMISCELLANEOUS2CALLBACKS structure and return this structure in the lpvData member of the DDHAL_GETDRIVERINFODATA structure.
  • GUID_D3DExtendedCaps
    The driver should allocate and initialize the appropriate members of the D3DHAL_D3DEXTENDEDCAPS structure and return this structure in the lpvData member of the DDHAL_GETDRIVERINFODATA structure.
  • GUID_ZPixelFormats
    The driver should allocate and initialize the appropriate members of a DDPIXELFORMAT structure for every Z-buffer format that the driver supports and return these structure(s) in the lpvData member of the DDHAL_GETDRIVERINFODATA structure. The driver must respond to this GUID if it supports the D3DDP2OP_CLEAR operation code in its implementation of D3dDrawPrimitives2.
  • GUID_D3DParseUnknownCommandCallback
    The driver should store the pointer to the Direct3D run time's D3DParseUnknownCommand callback. The pointer is passed to the driver in the lpvData member of the DDHAL_GETDRIVERINFODATA structure. The driver's D3dDrawPrimitives2 callback will call the D3DParseUnknownCommand callback to parse commands that the driver does not recognize.

See Also

Direct3D Implementation Guide

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.