views:

26

answers:

1

I'm using the following codes to copy D3D surface back to system memory, but the performance is bad when call LockRect operation, it spends lot of time of this function. Is there a way to improve it? Thanks in advance.

Below is sample codes.

D3DDev->GetRenderTargetData(renderTarget, offscreenSurface);

// Lock the surface to read pixels

offscreenSurface->LockRect( &lr, &rect, D3DLOCK_READONLY );

A: 

What D3D version? You can create a render target with HDC support, get it's surface and use surface->GetHDC() afterwards. I used this trick instead of 'LockRect', it gave acceptable performance for capturing D3D data to use with regular GDI or I/O.

Gobra