Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualHodgman

Posted 30 March 2013 - 06:40 AM

GetSurfaceLevel or CreateRenderTarget

These are two different ways to create a render target -- you can make a texture with the render target flag, and then get it's surface, or you can use create render target.

Usually you use the first method, because this way you have a VRAM allocation that's aliased as both a texture and a surface (i.e. you can read and write to the allocation).

 

With CreateRenderTarget, the allocation is only accessible as a surface, and not as a texture, so you can't directly read from it (the only way to read from them is StretchRect).

You generally only use these kinds of render-targets when you're using MSAA (i.e. if you're using CreateRenderTarget with D3DMULTISAMPLE_NONE, then you may as well be using CreateTexture with D3DUSAGE_RENDERTARGET, followed by GetSurfaceLevel).

 

1) binding the Surface to the Pipeline using SetRenderTarget(0, surface)..

2) using StretchRectangle to blit the result

You can use either of these with either of the above two methods for creating a render target.

#1 is preferable because you're rendering directly to the render-target.

With #2, you're rendering first to an intermediate render target, and then copying it to your destination, which is unnecessary work.


#1Hodgman

Posted 30 March 2013 - 06:35 AM

GetSurfaceLevel or CreateRenderTarget

These are two different ways to create a render target -- you can make a texture with the render target flag, and then get it's surface, or you can use create render target.

They're both equivalent, but usually you use the first method.

 

1) binding the Surface to the Pipeline using SetRenderTarget(0, surface)..

2) using StretchRectangle to blit the result

You can use either of these with either of the above two methods for creating a render target.

#1 is preferable because you're rendering directly to the render-target.

With #2, you're rendering first to an intermediate render target, and then copying it to your destination, which is unnecessary work.


PARTNERS