DD_D3DBUFCALLBACKS structure (ddrawint.h)

The DD_D3DBUFCALLBACKS structure is used only by drivers that implement driver level allocation of command and vertex buffers.

Syntax

typedef struct _DD_D3DBUFCALLBACKS {
  DWORD                     dwSize;
  DWORD                     dwFlags;
  PDD_CANCREATESURFACE      CanCreateD3DBuffer;
  PDD_CREATESURFACE         CreateD3DBuffer;
  PDD_SURFCB_DESTROYSURFACE DestroyD3DBuffer;
  PDD_SURFCB_LOCK           LockD3DBuffer;
  PDD_SURFCB_UNLOCK         UnlockD3DBuffer;
} DD_D3DBUFCALLBACKS, *PDD_D3DBUFCALLBACKS;

Members

dwSize

Specifies the size in bytes of this DD_D3DBUFCALLBACKS structure.

dwFlags

Reserved.

CanCreateD3DBuffer

Points to the driver's CanCreateD3DBuffer callback.

CreateD3DBuffer

Points to the driver's CreateD3DBuffer callback.

DestroyD3DBuffer

Points to the driver's DestroyD3DBuffer callback.

LockD3DBuffer

Points to the driver's LockD3DBuffer callback.

UnlockD3DBuffer

Points to the driver's UnlockD3DBuffer callback.

Remarks

Drivers that manage their own command and vertex buffers must fill out a DD_D3DBUFCALLBACKS structure and point the lpD3DBufCallbacks member of DD_HALINFO to it.

The driver must also support the callback functions reported in the DD_D3DBUFCALLBACKS structure. These XxxD3DBuffer callbacks are each analogous to the DdXxxSurface callback of similar name; they have the same prototypes and are called with the same input parameters. These new callbacks are called only when the surface in question has the DDSCAPS_EXECUTEBUFFER flag set in the surface caps. The buffer creation flags are DDSCAPS_WRITEONLY, DDSCAPS2_VERTEXBUFFER and DDSCAPS2_COMMANDBUFFER.

The driver determines the type of buffer being requested by checking the ddsCaps member of the DD_SURFACE_LOCAL structure that is passed to CanCreateD3DBuffer and CreateD3DBuffer for the following flags:

  • DDSCAPS_VERTEXBUFFER

    Indicates that the driver should allocate an explicit vertex buffer.

  • DDSCAPS_COMMANDBUFFER

    Indicates that the driver should allocate a command buffer.

  • The absence of both these flags

    Indicates that the driver should allocate an implicit vertex buffer.

Implicit vertex buffers should not be placed in video memory because they are expected to be read/write. Only explicit vertex buffers with the DDSCAPS_WRITEONLY flag set can be safely placed in video memory.

Requirements

Requirement Value
Header ddrawint.h (include Winddi.h)

See also

CanCreateD3DBuffer

CreateD3DBuffer

DD_HALINFO

DD_SURFACE_LOCAL

DestroyD3DBuffer

LockD3DBuffer

UnlockD3DBuffer