Sunday, August 9, 2009

Fun with Render to Texture

I'm starting to feel as if I'm in a time warp here...

Today I completed the render to texture water warp updates. The bad news is that we're right back to DirectQ 1.2 performance with them; i.e. slow. Note slideshow slow, and still very playable, but slow nonetheless.

Further analysis reveals that the whole render to texture framework has minimal FPS loss right up the the moment you start to render something. What this means is that I can retrieve a surface from the rendertarget texture, set it as the new rendertarget, release it when done, and subsequently use it as a texture for the normal render, with about a 1% FPS drop. Sweet. However, as soon as I draw to the new rendertarget I get something like a 30% FPS drop.

This is across the board, consistent, and - funnily enough - static. It doesn't matter if I update 1 surface or update 50, the drop is a steady 30%.

Now what this says to me is that there is something else at work here, most probably some flag or option which is required but which isn't as well documented as it should be.

The next step is to go hunting for some practical real-world RTT examples and compare my code to them so that I can get a better feel for what's happening (and why).

0 comments: