• Advertisement
Sign in to follow this  

From SYSTEMMEM into RENDERTARGET(D3D9Textures)

This topic is 898 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

As the topic states, is their a work around I am missing from the MSDN documentation? From RENDERTARGET into SYSTEMMEM you can simply use IDirect3DDevice9::GetRenderTargetData().

 

Any thoughts?

 

Thank you

Share this post


Link to post
Share on other sites
Advertisement

A render-target (aka a surface) is also a texture (they're both just "views" of a common memory allocation).

 

IDirect3DDevice9::StretchRect and IDirect3DDevice9::UpdateSurface do surface->surface copies. You can make a system-mem surface as the source IIRC, with IDirect3DDevice9::CreateOffscreenPlainSurface.

IDirect3DSurface9::LockRect acquires a pointer into the surface data, but this won't work for surfaces that are render-targets. 

 

Usually you'd use textures instead of surfaces though -- IDirect3DDevice9::CreateTexture and then use IDirect3DTexture9::LockRect to get a pointer to it's data.

On WinVista+, you can actually create a system-mem texture around an existing memory allocation, so that you don't have to copy from your memory into the texture. You can then tell D3D to copy this system-mem texture into a GPU-mem texture with IDirect3DDevice9::UpdateTexture.

 

See also:

Performance Optimizations - Using Dynamic Textures

How to: Use dynamic resources

 

What's your actual use-case?

Share this post


Link to post
Share on other sites

Thank you for the feedback. I guess I glanced a little to fast over the UpdateTexture function as that is what I needed. Appreciate the time and answer,

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement