Jump to content
  • Advertisement
Sign in to follow this  
Narf the Mouse

SlimDX/DirectX9 - What are the methods of getting information off the GPU after processing?

This topic is 2636 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

SlimDX/DirectX9 - What are the methods of getting information off the GPU after processing? That is to say, if I want to process information on the GPU, how can the CPU access it afterwards? I imagine Effect.GetValue<T>() would work, but is there anything else?

Thanks.

Share this post


Link to post
Share on other sites
Advertisement

SlimDX/DirectX9 - What are the methods of getting information off the GPU after processing? That is to say, if I want to process information on the GPU, how can the CPU access it afterwards?


In DX9 the only possible output for a GPU is a render target. So you need to render your data to the render target, then use GetRenderTargetData to copy that data to a SYSTEM surface, and then lock that system surface to get the data. Just be careful if you're concerned with performance, since this will cause a CPU/GPU synch which will stall the CPU until the rendering operations are complete.


I imagine Effect.GetValue<T>() would work, but is there anything else?


This will just get the value of a shader constant. Shader constants are not writable by the GPU, which is why they're called "constants".

Share this post


Link to post
Share on other sites

[quote name='Narf the Mouse' timestamp='1316985642' post='4865860']
SlimDX/DirectX9 - What are the methods of getting information off the GPU after processing? That is to say, if I want to process information on the GPU, how can the CPU access it afterwards?


In DX9 the only possible output for a GPU is a render target. So you need to render your data to the render target, then use GetRenderTargetData to copy that data to a SYSTEM surface, and then lock that system surface to get the data. Just be careful if you're concerned with performance, since this will cause a CPU/GPU synch which will stall the CPU until the rendering operations are complete.


I imagine Effect.GetValue<T>() would work, but is there anything else?


This will just get the value of a shader constant. Shader constants are not writable by the GPU, which is why they're called "constants".
[/quote]
Thanks.

I wasn't aware they were constants, although that does explain a lot.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!