PDA

View Full Version : CPU usage and performance tuning


dstn
07-21-03, 02:07 PM
Hi,

I'm writing an app that uses the graphics card to do image coprocessing. I use mostly register combiners, texture shaders, and blending. I transfer a fairly small amount of data to the card and then make many rendering passes, using glCopyTexSubImage to read results from the framebuffer back to texture memory (I'm using Linux so render-to-texture doesn't seem to be an option - which sucks). I'm finding that the CPU usage is close to 100% - which sort of defeats the purpose of the exercise. I've also noticed that sometimes small changes such as changing the destination texture of a glCopyTexSubImage call can have a big impact on performance. Does anyone know of documentation that describes performance pitfalls to avoid, or have suggestions on how to track down CPU-hogging code and other performance bottlenecks?

Cheers,
dstn.

SurfMonkey
07-21-03, 04:30 PM
You shouldn't be getting such a huge cost from using glCopyTexSubImage, maybe the Linux drivers have a poor implementation.

What card are you using and have you made sure that your frame buffer and the texture have the same pixel format?

dstn
07-21-03, 04:43 PM
Originally posted by SurfMonkey
You shouldn't be getting such a huge cost from using glCopyTexSubImage, maybe the Linux drivers have a poor implementation.

It's not a huge cost, it's just that, for example, if you're doing multiple passes and you need to use the results from one pass in the next pass, it's faster to "ping-pong" the intermediate results between two textures, rather than using just one texture. I assume this is a pipelining/synchronisation sort of issue, but I only found this out by experimentation, not from documentation. What I'd really like is documentation that exposes these sorts of "secret" performance tricks.

What card are you using and have you made sure that your frame buffer and the texture have the same pixel format?

My machine has a Ti4200 but I've also tried it on FX5800, with the same results (although about 60% faster... :) )

Yeah, framebuffer is RGBA and most textures are RGB, some RGBA and DSDT.

Cheers,
dstn.