?/TD>
Microsoft DirectX 9.0

D3DLOCK


A combination of zero or more locking options that describe the type of lock to perform.

#defineDescription
D3DLOCK_DISCARDThe application overwrites (with a write-only operation) every location within the region being locked. This is a valid option when using dynamic textures, dynamic vertex buffers, and dynamic index buffers.

For vertex and index buffers, the application discards the entire buffer. A pointer to a new memory area is returned so that the dynamic memory access (DMA) and rendering from the previous area do not stall.

For textures, the application overwrites (with a write-only operation) every location within the region being locked.

D3DLOCK_DONOTWAITAllows an application to gain back CPU cycles if the driver cannot lock the surface immediately. If this flag is set and the driver cannot lock the surface immediately, the lock call will return D3DERRR_WASSTILLDRAWING. This flag can only be used when calling LockRect on surfaces created using IDirect3DDevice9::CreateOffscreenPlainSurface, IDirect3DDevice9::CreateRenderTarget, or IDirect3DDevice9::CreateDepthStencilSurface. This flag can also be used with a back buffer.
D3DLOCK_NO_DIRTY_UPDATEBy default, a lock on a resource adds a dirty region to that resource. This option prevents any changes to the dirty state of the resource. Applications should use this option when they have additional information about the set of regions changed during the lock operation.
D3DLOCK_NOOVERWRITEThe application promises not to overwrite any data in the vertex and index buffers. Specifying this flag allows the driver to return immediately and continue rendering, using this buffer. If this flag is not used, the driver must finish rendering before returning from locking.
D3DLOCK_NOSYSLOCK

The default behavior of a video memory lock is to reserve a system-wide critical section, guaranteeing that no display mode changes will occur for the duration of the lock. This option causes the system-wide critical section not to be held for the duration of the lock.

The lock operation is time consuming, but can enable the system to perform other duties, such as moving the mouse cursor. This option is useful for long-duration locks, such as the lock of the back buffer for software rendering that would otherwise adversely affect system responsiveness.

D3DLOCK_READONLYThe application will not write to the buffer. This enables resources stored in non-native formats to save the recompression step when unlocking.

Constant Information

Headerd3d9types.h
Minimum operating systemWindows 98

Related Topics



© 2002 Microsoft Corporation. All rights reserved.