PDD_SURFCB_LOCK callback function

The LockD3DBuffer callback function is used to lock a specified area of buffer memory and to provide a valid pointer to a block of memory associated with the buffer.

Syntax

PDD_SURFCB_LOCK LockD3DBuffer;

DWORD APIENTRY LockD3DBuffer(
   PDD_LOCKDATA lpLockD3DBuffer
)
{ ... }

Parameters

  • lpLockD3DBuffer
    Points to a DD_LOCKDATA structure that contains the information required to perform the lockdown.

Return value

LockD3DBuffer returns one of the following callback codes:

DDHAL_DRIVER_HANDLED

DDHAL_DRIVER_NOTHANDLED

Remarks

This callback is used only if the driver manages driver-level command and vertex buffers.

LockD3DBuffer should set the ddRVal member of the DD_LOCKDATA structure at lpLockD3DBuffer to DDERR_WASSTILLDRAWING and return DDHAL_DRIVER_HANDLED if a blt or flip is in progress.

Unless otherwise specified by the dwFlags member of DD_LOCKDATA, the driver can return a memory pointer to the top of the buffer in the lpSurfData member of DD_LOCKDATA. If the driver must calculate its own address for the buffer, it can rely on the pointer passed in the fpProcess member of DD_LOCKDATA to be a per-process pointer to the user-mode mapping of its Microsoft DirectDraw-accessible frame buffer.

A lock does not provide exclusive access to the requested memory block. That is, multiple threads can lock the same buffer at the same time. It is the application's responsibility to synchronize access to the memory block that the pointer is being obtained for.

This call has the same prototype as the DdLock function. The LockD3DBuffer callback is used instead when the surface in question has the DDSCAPS_EXECUTEBUFFER flag set in the ddsCaps member of the DD_SURFACE_LOCAL structure.

If a vertex buffer is being locked and is also being rendered from by the hardware, stall the LockD3DBuffer if you are not renaming (via D3DHALDP2_SWAPVERTEXBUFFER). If you rename, then there is no need to stall.

LockD3DBuffer can be called with a disabled PDEV. A PDEV is disabled or enabled by calling the display driver's DrvAssertMode function. See Managing PDEVs for more information.

Requirements

Target platform

Desktop

Header

Ddrawint.h (include Winddi.h)

See also

DdLock

DD_LOCKDATA

DD_SURFACE_LOCAL

UnlockD3DBuffer

 

 

Send comments about this topic to Microsoft