I want to use two PBOs to read pixels in an alternative way. I thought the PBO path would be very fast, because glReadPixels come back immediately when using PLO, and many times can be overlapped.
Strangely does not seem to be of great benefit, like keeping some code in mind:
glBindBufferARB (GL_PIXEL_PACK_BUFFER_ARB, 0); Timer t; T.start (); GlReadPixels (0,0,1024,1024, GL_RGBA, GL_UnSIGNED_BYTE, buff); T.stop (); Std :: cout & lt; & Lt; T.getElapsedTimeInMilliSec () & lt; & Lt; ""; GlBindBufferARB (GL_PIXEL_PACK_BUFFER_ARB, Pibo); T.start (); GlReadPixels (0,0,1024,1024, GL_RGBA, GL_UnSIGNED_BYTE, 0); T.stop (); Std :: cout & lt; & Lt; T.getElapsedTimeInMilliSec () & lt; & Lt; Std :: endl; is the result
1.301 1.185 1.294 1.1 9 1.28 1.191 1.341 1.254 1.327 1.201 1.304 1.1 9 1.352 1.235 The PBA route is a bit faster, but not satisfactory instant-return a My question is:
- What is affecting the performance of GlReadPixels Factors? At some time, its cost reaches 10 MB, but 1.3 MM is.
-
Why is the instantaneous return as high as 1.2ms? Is it too big or normal? =================================== ======================================== In comparison with a demo, let me There are two factors:
- GL_BGRA is better than GL_RGBA, 1.3 ms => 1.0 mms (not PBO), 1.2 ms = & gt; 0.9 ms (with POO)
- GLUT_RGBA instead of glutInitDisplayMode (GLUT_RGB | GLUT_ALPHA), 0.9 ms = & gt; 0.01 msa; I want that performance in my system, GLUT_RGBA = GLUT_RGB = 0 GLUT_ALPHA = 8
Then one more two questions:
- Why better than GL-BGRA GL_RGBA is? Is this the case only for specific platforms or for all platforms?
- Why is GLUT_ALPHA so important that it strongly affects PBO performance?
I do not know the glutInitDisplayMode from the heart, but it usually does not But it happens because your internal and external formats do not match. For example, when you do not match the number of components, it will ignore asynchronous behavior because this conversion still blocks glReadPixels . So most likely that glutInitDisplay (GLUT_RGBA) will actually create a default framebuffer with an internal format which is actually RGB or here As far as the BGR is under the GLUT_ALPHA parameter it is possible to internally create RGBA or BGRA That matches the number of components you want. EDIT: I explained some issues about pixel packing and display effects.
Edit2: The performance advantage of BGRA is likely to be because internal HW buffer BGRA , there really is not much in it.
Comments
Post a Comment