   Render Target & Viewport 's Problem
  To render a mesh, we usually set world, view, projection matrix and set viewport matrix for changing vertex coordinate correctly.If i want to render a mesh to render target(a texture size 512x512), except changing world, view, projection matrix, must i change viewport matrix using SetViewport(&vp), D3DVIEWPORT9 vp = {0, 0, 512, 512, 0.0f, 1.0f}? It's must?Thanks!!!   
  No, that's not necessary. If you set the rendertarget using IDirect3DDevice9::SetRenderTarget(), the viewport is automatically reset to the full area of the rendertarget. You'd have to have an additional SetViewport() call only if you want to limit rendering to only a portion of that rendertarget.   ;  But keep in mind the projection matrix - it depends on aspect ratio, so there's a difference between the projection for let's say backbuffer with 800x600 (4:3) and render target with 512x512 (1:1).   