Render to non-square texture


Alemarius Nexus

Still Fresh
Joined
Jan 5, 2011
Messages
27
Age
30
Hi!


Now that I have my Pandora (1GHz model) in my hands and installed SL4P on it, I'm starting to play around with the SGX chip to see how fast it is. I have written a test program that does matrix-matrix multiplication on CPU first, and then on GPU using GLES2 shaders to compare performance. I did so by rendering into an FBO with a texture color attachment but recognized that the driver seems to have problems rendering to a non-square texture. I have then created a small test program that does nothing but create an FBO with RGBA8888 texture color attachment and uses glClear to render it completely white, without even shaders being used. Then I'm reading the results using glReadPixels. Now, when I create the texture with the same values for width and height, everything seems fine. But whenever I use different values for width and height, the driver just seems to consider it a square texture, leaving parts of the texture data undefined.


I've uploaded the code for this test program here:


http://alemariusnexu...oo.com/main.cpp


Output of this program run on my Pandora, with WIDTH=4 and HEIGHT=2 can be seen here:


http://alemariusnexu....com/output.log


So, am I missing something or is this a driver problem?


Thanks in advance!
 
I think glReadPixels should be blocking until GL is finished drawing, so glFinish is not needed. I tried it nonetheless, but inserting glFinish before (or after) glReadPixels did not make a difference.
 
If I remember from digging around in the driver source, NPOT/NSquare textures are implemented as square POTs, and then using strides and heights to ignore the unused parts.
 
Last edited by a moderator:
But then my 4x2 texture would be allocated as 4x4. That should not change results if I read just the first 4x2 pixels, right? Also, if the driver really did so, and I would have to adapt my usage of glReadPixels, wouldn't that be a violation of the GLES2 specification, or at least of the NPOT extension specifications?
 
Last edited by a moderator:
Back
Top