Render Retrieval

Started by
5 comments, last by LoreKeeper 18 years, 7 months ago
Hey :) I need to render some scenes and have the results available in system memory for manipulation; what is the fastest way to do this? The naive approach drops my frame rate to maybe 35fps or so (purely for the render, and recovery to system memory). Thanks for all help :D LoreKeeper
Advertisement
What's the 'naive' approach that you're using?
My suggestion would be to use D3DDevice9::GetRenderTargetData() for this purpose. For this to work you'll need to have a texture in SYSTEMPOOL memory of the same size and format of the rendertarget (best way to do this is to set up your rendertarget to be the same size and shape as your system texture by creating a D3DPOOL_DEFAULT texture with D3DUSAGE_RENDERTARGET and setting it as the rendertarget).

Keep in mind that this call does require transferring data between GPU and system memory, and will likely be rather slow in any case.
Do you need to export the image or just manipulate it? Render to surface is generally the way if you want to just have it to manipulate...

If you want to export just use D3DXSaveTextureToFile(...).

If you want to simply have it use these commands:

m_pd3dDevice->CreateTexture(...);
texture->GetSurfaceLevel(...);
m_pd3dDevice->SetRenderTarget(...);

The GetSurfaceLevel(...) which I know little about what it actually does, it seems to link the texture and surface?

Anywho good luck,
Brad
--X
The naive approach I'm talkin about is setting a rendersurface as accessable from system-memory (lockable) and then fetching the data.

I improved on that using the GetRenderTargetData method as well, which is faster - but honestly I was hoping that the old AGP speed limitations for downstream data was lifted by now.

Surely there must be a way to have a decent rate of data retrieval from the graphics card?
Quote:Original post by LoreKeeper
The naive approach I'm talkin about is setting a rendersurface as accessable from system-memory (lockable) and then fetching the data.

I improved on that using the GetRenderTargetData method as well, which is faster - but honestly I was hoping that the old AGP speed limitations for downstream data was lifted by now.

Surely there must be a way to have a decent rate of data retrieval from the graphics card?


I write to surfaces without a problem, and manipulate each inside of the pixel shader, i use 4 targets with very little speed decrease... Are you not manipulating them inside of the shaders?
--X
Quote:Original post by LoreKeeper
The naive approach I'm talkin about is setting a rendersurface as accessable from system-memory (lockable) and then fetching the data.

I improved on that using the GetRenderTargetData method as well, which is faster - but honestly I was hoping that the old AGP speed limitations for downstream data was lifted by now.

Surely there must be a way to have a decent rate of data retrieval from the graphics card?

There is no efficient way to retrieve data from the GPU to the CPU, not even on PCI-Express. (It's better there, but not optimal either).

I'm not doing manipulation in the pixel shaders.

To clear up what I'm actually doing:

I'm retrieving rendering results between different frames and performing motion estimation matches on it. The renders themselves are just a tool and data-source for the real work that happens on the CPU (revolving around 3D reconstruction from motion data).

thanks for all the input; pity there isn't a decent GPU-to-CPU stream available yet. :/

This topic is closed to new replies.

Advertisement