[Mesa-dev] Performance glxSwapBuffers 32 bit vs. 64 bit
Michel Dänzer
michel at daenzer.net
Tue Nov 15 07:36:05 PST 2011
On Fre, 2011-11-11 at 21:25 +0100, Theiss, Ingo wrote:
> Am Freitag, 11. November 2011 14:53 CET, Brian Paul <brian.e.paul at gmail.com> schrieb:
>
> > Ingo, if you could find out what the format/type parameters to
> > glReadPixels are, we could look into some optimization in the state
> > tracker. I wouldn't be surprised if there's some channel swizzling or
> > format conversion going on.
>
> Hi Brian,
>
> I have digged around in the VirtualGL source code and hope I have
> found what you requested. Don´t blame me if I am wrong as I have very
> limited knowledge in C programming :-(
I suspect Brian might have been thinking of running your app in gdb,
setting a breakpoint in _mesa_ReadPixels and reporting the actual values
that are passed in there from glxSwapBuffers.
> Here is the (overwritten?) glReadPixels function from VirtualGL:
>
> void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
> GLenum format, GLenum type, GLvoid *pixels)
> {
> TRY();
> if(format==GL_COLOR_INDEX && !ctxh.overlaycurrent() && type!=GL_BITMAP)
> {
> format=GL_RED;
> if(type==GL_BYTE || type==GL_UNSIGNED_BYTE) type=GL_UNSIGNED_BYTE;
> else
> {
> int rowlen=-1, align=-1; GLubyte *buf=NULL;
> _glGetIntegerv(GL_PACK_ALIGNMENT, &align);
> _glGetIntegerv(GL_PACK_ROW_LENGTH, &rowlen);
> newcheck(buf=new unsigned char[width*height])
> if(type==GL_SHORT) type=GL_UNSIGNED_SHORT;
> if(type==GL_INT) type=GL_UNSIGNED_INT;
> glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
> glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
> glPixelStorei(GL_UNPACK_ROW_LENGTH, 1);
> _glReadPixels(x, y, width, height, format, GL_UNSIGNED_BYTE, buf);
> glPopClientAttrib();
> _rpixelconvert(unsigned short, GL_UNSIGNED_SHORT, 2)
> _rpixelconvert(unsigned int, GL_UNSIGNED_INT, 4)
> _rpixelconvert(float, GL_FLOAT, 4)
> delete [] buf;
> return;
> }
> }
> _glReadPixels(x, y, width, height, format, type, pixels);
> CATCH();
> }
>
> One more noob question regarding this code: Is the glReadPixels
> function with the underscore the call to the "parent" glReadPixels
> function of libGL.so? I have not found the _glReadPixels function
> inside the VirtualGL code so this seems the only explanation to me.
The above procedure should answer this question as well. Otherwise, it
would rather be a question for VirtualGL developers, though it looks
like it is as you say.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Debian, X and DRI developer
More information about the mesa-dev
mailing list