Home > 计算机与 Internet > How can CPU Read Data From Direct3D10 RenderTargets?

How can CPU Read Data From Direct3D10 RenderTargets?

In D3D9 applications, rendertargets can be locked, then CPU can read data from it. It was usful for tricks such as Per-Pixel Picking. In D3D10, the rendertarget’s resources should be created with usage flag D3D10_USAGE_DEFAULT, but the only resource that can mark with CPU_ACCESS_FLAGs is D3D10_USAGE_STAGING. Current trick is to create TWO Resources, one with D3D10_USAGE_DEFAULT which the RenderTargetView is created from, another with D3D10_USAGE_STAGING, and D3D10_CPU_ACCESS_READ. To Read data from the RenderTarget, use ID3D10Device::CopyResource to copy data onto the Staging resource, and then Map the resource as usual.

rough idea from discussion on http://www.gamedev.net/community/forums/topic.asp?topic_id=447598&whichpage=1&#2961478

Advertisements
Categories: 计算机与 Internet
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: