I’m experiencing serious performance problems when calling
glTexSubImage2D() with width or height = 1 to copy a thin rectangular
region on a texture (just a vertical or horizontal line) (running under windows xp)
Tried glTexSubImage1D() already?
From my experiences using glReadPixels() and glTexSubImage2D(), both had a fairly constant execution time, whether I was reading 10,000 or 100 pixels (especially noticed this in glReadPixels) so perhaps there’s a constant overhead associated with the call that’s causing the just copying 1 row over to seem slow for the amount of data that must be sent.
The hardware usually does a single block lookup (e.g. 16x16 ) although your pixel shader only contains a single textureXXX call. The block is then used for a fragment (some pixel in a small region). Therefore you have to expect slow downs, if your projected vertices are not next to each other or you access the texels sequentially (=linear as you did) or ‘randomly’ (that’s even worse)…
OK, I will try the glTexSubImage1D() method - (but I still think there’s be a bug in glTexSubImage2D() for width=1 or height=1, since my CPU load is approx. ten times higher than using width=2 or height = 2. I’m just updating a small line of a larger texture, which is the displayed as a simple, rectangular image.)
I’d be interested to hear more about what sort of performance issues you have, does it actually take longer to do a 1 by x, than a 2 by x? Also are you certain that it’s both width = 1 and the height = 1 cases, if it was just one of those I’d have an almost certain cause but it would be unlikely to cause a problem in both cases.