<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Direct3D</title><link>http://forums.xna.com/forums/27.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>Re: Alternative to CreateOffscreenPlainSurface to read out from a RenderTarget surface/texture?</title><link>http://forums.xna.com/forums/thread/193949.aspx</link><pubDate>Sat, 27 Jun 2009 06:31:30 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:193949</guid><dc:creator>Ralf Kornmann</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/193949.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=27&amp;PostID=193949</wfw:commentRss><description>Instead of creating a surface with the render target usage you can create a render target directly. The CreateRenderTarget function supports an additional parameter that allows you to make your target lookable. But using this feature can have a performaces impact too as the driver may be forced to store the target in a less optimal memory location.</description></item><item><title>Alternative to CreateOffscreenPlainSurface to read out from a RenderTarget surface/texture?</title><link>http://forums.xna.com/forums/thread/192513.aspx</link><pubDate>Tue, 23 Jun 2009 02:57:17 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:192513</guid><dc:creator>WiizzZZ</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/192513.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=27&amp;PostID=192513</wfw:commentRss><description>&lt;br /&gt;
I&amp;#39;m writing an app in XNA/C# where I need to process Data with the GPU.&lt;br /&gt;
&lt;br /&gt;
I put my data into a R32F texture since the data is a float[].&lt;br /&gt;
I then create a Surface with a Usage.RenderTarget, and a RenderToSurface.&lt;br /&gt;
I render a Sprite of the Texture, and I have a shader that processes each pixel.&lt;br /&gt;
&lt;br /&gt;
All work well so far...&lt;br /&gt;
I then need to read the data back to CPU: &lt;br /&gt;
I cannot use LockRectangle on the RenderSurface, because it has to be in Pool.Default and this is not allowed, so the only way I found was to use CreateOffscreenPlainSurface to create a new Surface that is in SystemMemory, copy the RenderSurface into that Surface using GetRenderTargetData, and LockRectangle on the PlainSurface then read the stream from LockRectangle.&lt;br /&gt;
&lt;br /&gt;
All goes well on my nVidia 8600GT, but when I run it on my Laptop (Intel GMA x3100), there is no R32F format for OffscreenPlainSurface.&lt;br /&gt;
&lt;br /&gt;
So, I&amp;#39;m wondering if there is another way to read the data back from a RenderToSurface directly, without the extra copy.&lt;br /&gt;
The only other way I see right now is to convert the data to A8R8G8B8, rebuild it in the shader, then render in A8R8G8B8 and read that out...&lt;br /&gt;
but that seems like a very unefficient way to work with floats!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Any other suggestion would be very welcome!&lt;br /&gt;
&lt;br /&gt;
Regards&lt;br /&gt;
&lt;br /&gt;</description></item></channel></rss>