SDK中对 LockRect的说明
SDK中对 LockRect的说明
---------------------------------------------------------------------------------------------------------------------- IDirect3DSurface9:ockRect Method
Locks a rectangle on a surface. Syntax HRESULT LockRect(
D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags ); Parameters pLockedRect [out] ointer to a MSITStore:C:\Program%20Files\Microsoft%20DirectX%209.0%20SDK%20(April%202005)\Documentation\DirectX9\directx9_c.chm::/directx/graphics/reference/d3d/structures/d3dlocked_rect.htm">D3DLOCKED_RECT structure that describes the locked region. pRect [in] ointer to a rectangle to lock. Specified by a pointer to a RECT
structure. Specifying NULL for this parameter expands the dirty region to cover the entire surface. Flags [in] Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are: D3DLOCK_DISCARD D3DLOCK_DONOTWAIT D3DLOCK_NO_DIRTY_UPDATE D3DLOCK_NOSYSLOCK D3DLOCK_READONLY You may not specify a subrect when using D3DLOCK_DISCARD. For a description of the flags, see MSITStore:C:\Program%20Files\Microsoft%20DirectX%209.0%20SDK%20(April%202005)\Documentation\DirectX9\directx9_c.chm::/directx/graphics/reference/d3d/constants/D3DLOCK.htm">D3DLOCK. Return Value If the method succeeds, the return value is MSITStore:C:\Program%20Files\Microsoft%20DirectX%209.0%20SDK%20(April%202005)\Documentation\DirectX9\directx9_c.chm::/directx/graphics/reference/d3d/enums/D3DERR.htm#D3D_OK">D3D_OK. If the method fails, the return value can be MSITStore:C:\Program%20Files\Microsoft%20DirectX%209.0%20SDK%20(April%202005)\Documentation\DirectX9\directx9_c.chm::/directx/graphics/reference/d3d/enums/D3DERR.htm#D3DERR_INVALIDCALL">D3DERR_INVALIDCALL or MSITStore:C:\Program%20Files\Microsoft%20DirectX%209.0%20SDK%20(April%202005)\Documentation\DirectX9\directx9_c.chm::/directx/graphics/reference/d3d/enums/D3DERR.htm#D3DERR_WASSTILLDRAWING">D3DERR_WASSTILLDRAWING.
Remarks If the D3DLOCK_DONOTWAIT flag is specified and the driver cannot lock the surface immediately, IDirect3DSurface9:ockRect will return D3DERR_WASSTILLDRAWING so that an application can use the CPU cycles while waiting for the driver to lock the surface. The only lockable format for a depth-stencil surface is D3DFMT_D16_LOCKABLE. See MSITStore:C:\Program%20Files\Microsoft%20DirectX%209.0%20SDK%20(April%202005)\Documentation\DirectX9\directx9_c.chm::/directx/graphics/reference/d3d/enums/d3dformat.htm">D3DFORMAT. For performance reasons, dirty regions are recorded only for level zero of a texture. Dirty regions are automatically recorded when IDirect3DSurface9:ockRect is called without D3DLOCK_NO_DIRTY_UPDATE or D3DLOCK_READONLY. See MSITStore:C:\Program%20Files\Microsoft%20DirectX%209.0%20SDK%20(April%202005)\Documentation\DirectX9\directx9_c.chm::/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/UpdateTexture.htm">IDirect3DDevice9::UpdateTexture for more information. A multisample back buffer cannot be locked. This method cannot retrieve data from a surface that is is contained by a texture resource created with MSITStore:C:\Program%20Files\Microsoft%20DirectX%209.0%20SDK%20(April%202005)\Documentation\DirectX9\directx9_c.chm::/directx/graphics/reference/d3d/constants/D3DUSAGE.htm">D3DUSAGE_RENDERTARGET because such a texture must be assigned to MSITStore:C:\Program%20Files\Microsoft%20DirectX%209.0%20SDK%20(April%202005)\Documentation\DirectX9\directx9_c.chm::/directx/graphics/reference/d3d/enums/d3dpool.htm#D3DPOOL_DEFAULT">D3DPOOL_DEFAULT memory and is therefore not lockable. In this case, use instead MSITStore:C:\Program%20Files\Microsoft%20DirectX%209.0%20SDK%20(April%202005)\Documentation\DirectX9\directx9_c.chm::/directx/graphics/reference/d3d/interfaces/IDirect3DDevice9/GetRenderTargetData.htm">IDirect3DDevice9::GetRenderTargetData to copy texture data from device memory to system memory. ---------------------------------------------------------------------------------------------------------------------------------------- |