<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>Stalling the pipeline</title><link>http://blogs.msdn.com/shawnhar/archive/2008/04/14/stalling-the-pipeline.aspx</link><description>Normally, the CPU and GPU run in parallel. Framerate = max(CPU time, GPU time) . If your code causes a pipeline stall, however, the processors must take turns to run while the other one sits idle. Yikes! Now framerate = CPU time + GPU time . In other</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Stalling the pipeline</title><link>http://blogs.msdn.com/shawnhar/archive/2008/04/14/stalling-the-pipeline.aspx#8395453</link><pubDate>Tue, 15 Apr 2008 02:39:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8395453</guid><dc:creator>ajmiles</dc:creator><description>&lt;p&gt;Could you cause a stall by modifying a texture that is due to be used by a draw call in the buffer that has yet to be executed?&lt;/p&gt;
</description></item><item><title>re: Stalling the pipeline</title><link>http://blogs.msdn.com/shawnhar/archive/2008/04/14/stalling-the-pipeline.aspx#8395772</link><pubDate>Tue, 15 Apr 2008 04:00:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8395772</guid><dc:creator>sh8zen</dc:creator><description>&lt;p&gt;A shot in the semi-dark:&lt;/p&gt;
&lt;p&gt;Would it be setting the device.Texture[0] = ...&lt;/p&gt;
&lt;p&gt;in the draw call just before drawing the mesh that needs the texture?&lt;/p&gt;
</description></item><item><title>re: Stalling the pipeline</title><link>http://blogs.msdn.com/shawnhar/archive/2008/04/14/stalling-the-pipeline.aspx#8396306</link><pubDate>Tue, 15 Apr 2008 06:42:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8396306</guid><dc:creator>Ultrahead</dc:creator><description>&lt;p&gt;Maybe:&lt;/p&gt;
&lt;p&gt;a) trying to write a huge polygon?&lt;/p&gt;
&lt;p&gt;b) Or a huge mesh with a great deal of small polygons?&lt;/p&gt;
&lt;p&gt;b) lots of state changes?&lt;/p&gt;
&lt;p&gt;c) Pushing the GPU limit using large texture sizes?&lt;/p&gt;
&lt;p&gt;d) locking a source of data like the vertex buffer when the CPU and GPU need to sync? As if we forget unlocking it?&lt;/p&gt;
&lt;p&gt;What? Whaattt?&lt;/p&gt;
</description></item><item><title>re: Stalling the pipeline</title><link>http://blogs.msdn.com/shawnhar/archive/2008/04/14/stalling-the-pipeline.aspx#8397201</link><pubDate>Tue, 15 Apr 2008 13:18:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8397201</guid><dc:creator>MartSlot</dc:creator><description>&lt;p&gt;What about calling present? Or am I thinking too simple now?&lt;/p&gt;
</description></item><item><title>re: Stalling the pipeline</title><link>http://blogs.msdn.com/shawnhar/archive/2008/04/14/stalling-the-pipeline.aspx#8397580</link><pubDate>Tue, 15 Apr 2008 16:52:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8397580</guid><dc:creator>Zyxil</dc:creator><description>&lt;p&gt;Shawn,&lt;/p&gt;
&lt;p&gt;This stall doesn't happen with RenderTarget2D.GetTexture(), does it? &amp;nbsp;I thought that call made a copy of the RT2D texture to a new texture in video memory, the return is just a reference to a new chunk of vram. &amp;nbsp;Shoudl be nice and fast, since the op is not working within a SpriteBatch.Begin-End block and is pulling the data from a RT that is not the current RT. &amp;nbsp;Right?&lt;/p&gt;
</description></item><item><title>re: Stalling the pipeline</title><link>http://blogs.msdn.com/shawnhar/archive/2008/04/14/stalling-the-pipeline.aspx#8397851</link><pubDate>Tue, 15 Apr 2008 19:24:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8397851</guid><dc:creator>ShawnHargreaves</dc:creator><description>&lt;p&gt;Zyxil: don't worry, that won't stall.&lt;/p&gt;
&lt;p&gt;RenderTarget2D.GetTexture just returns a reference to a texture object, so it doesn't care whether the GPU has actually finished drawing data into that area of video memory yet. It can give you back an object straight away, while the driver stores some internal state to remember that this texture is not actually filled in yet.&lt;/p&gt;
&lt;p&gt;What happens next depends on what you do with that texture.&lt;/p&gt;
&lt;p&gt;If you draw it (using a SpriteBatch, or a custom shader, or whatever), there is no problem. The driver can send another command to the GPU saying &amp;quot;ok, now draw using this texture&amp;quot;. It doesn't matter that the texture is not filled in yet, because it will be by the time the GPU gets around to processing this drawing call which uses it.&lt;/p&gt;
&lt;p&gt;The problem is if you call GetData on the texture. At that point, the contents of the texture are read back to the CPU, which cannot proceed until the data is actually filled in, so you have a stall.&lt;/p&gt;
</description></item><item><title>re: Stalling the pipeline</title><link>http://blogs.msdn.com/shawnhar/archive/2008/04/14/stalling-the-pipeline.aspx#8398241</link><pubDate>Wed, 16 Apr 2008 00:21:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8398241</guid><dc:creator>Zyxil</dc:creator><description>&lt;p&gt;Thanks for the clarification, Shawn. &amp;nbsp;I was pretty sure that's how it worked, but I just wrote a bunch of RT2D code for drawing GUI Dialogs and I didn't want to have to go back and rewrite it all three months from now when I start stressing the app.&lt;/p&gt;
&lt;p&gt;Love the blog! Keep it up!&lt;/p&gt;
</description></item></channel></rss>