   How to download texture into mem except LockRect()?
  I can use D3DXLoadSurfaceFromMemory to upload a surface directly from a memory pointer. And the function takes into account of the pitch difference.So can I use some function to do the reverse?LockRect() then copy one by one in a loop is quite slow, while I can''t use memcpy since there is a pitch difference. 
  You can use memcpy, just line for line. ;quote:Original post by Endurion  You can use memcpy, just line for line.   Besides, the two is different in byte format.I want to download a texture of D3DFMT_A8R8G8B8to a in-memory D3DFMT_R8G8B8 array.Seems only the pixel-by-pixel way. ;  You could adapt to the different pixel formats problem by just using the same format as on the card, and then simply ignoring alpha if you don't need it. Incidentally, this kind of thing is one of the reasons why padded formats (for example x8r8g8b8) exist.As for the other issue, I second Endurion's answer (scanline copies, one at a time).-NikEDIT: By the way: on current graphics architectures, readback from video memory isn't going to be very fast operation anyway. Are you sure you can't perform the effect entirely on shaders without readback (on card, that is)?   [edited by - Nik02 on February 2, 2004 8:35:18 AM];  A bit strange that my FX5200 can''t support D3DFMT_R8G8B8,so I have to create a texture with D3DFMT_A8B8G8R8,render,lock it and download one by one while changing the format to D3DFMT_B8G8R8, skipping the A8.Any other way? ;  That sounds like it. Although I''d probably memcpy() one line at a time to a work buffer (perhaps on the stack) and then extract the RGB out of there. It''s quite usual for cards not to texture in 3-byte formats, because they don''t hardware very well.;quote:Original post by softimage  A bit strange that my FX5200 can''t support D3DFMT_R8G8B8,so I have to create a texture with D3DFMT_A8B8G8R8,Actually D3DFMT_R8G8B8 isn''t well supported at all. 24-bit formats are very inefficient in terms of performance. D3DFMT_X8R8G8B8 is supported by just about everything though. Stay Casual,KenDrunken Hyena