Direct3D Driver Initialization

When the driver's DrvGetDirectDrawInfo function is called by the Microsoft DirectDraw runtime to initialize DirectDraw support, the driver must do the following to indicate its Microsoft Direct3D capabilities:

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

  • Set the DDSCAPS_Xxx flags in the ddCaps.ddsCaps member of the DD_HALINFO structure that describe the 3D capabilities of a driver's video memory surface. The flags are listed in the following table.

    Flag Meaning

    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 DD_HALINFO structure to point to the driver's DdGetDriverInfo callback. The driver must also set the DDHALINFO_GETDRIVERINFOSET flag in the dwFlags member of the DD_HALINFO structure to indicate that it has implemented the DdGetDriverInfo callback.

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

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

To indicate that the driver is capable of working with Microsoft DirectX 7.0, it should do the following:

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

  • Respond to the GUID_Miscellaneous2Callbacks GUID in DdGetDriverInfo callback by setting the GetDriverState, CreateSurfaceEx, and DestroyDDLocal members of the DD_MISCELLANEOUS2CALLBACKS structure. These are set to point to the appropriate callbacks for the Direct3D driver and ORed in the dwFlags member with the DDHAL_MISC2CB32_CREATESURFACEEX, DDHAL_MISC2CB32_GETDRIVERSTATE, and DDHAL_MISC2CB32_DESTROYDDLOCAL bits, respectively.

After DrvGetDirectDrawInfo returns, GDI calls the driver's DdGetDriverInfo callback several times for different GUIDs to complete the driver's initialization. The DdGetDriverInfo callback must respond to the following GUIDs to support Direct3D:

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 DD_GETDRIVERINFODATA structure.

GUID_Miscellaneous2Callbacks
The driver should allocate and initialize the members of the DD_MISCELLANEOUS2CALLBACKS structure and return this structure in the lpvData member of the DD_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 DD_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 structures in the lpvData member of the DD_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 runtime's D3DParseUnknownCommand callback. The pointer is passed to the driver in the lpvData member of the DD_GETDRIVERINFODATA structure. The driver's D3dDrawPrimitives2 callback calls the D3DParseUnknownCommand callback to parse commands that the driver does not recognize.

For more information, see DirectDraw Driver Initialization.