Am Freitag, 11. November 2011 14:53 CET, Brian Paul <brian.e.p...@gmail.com> schrieb: > 2011/11/11 Michel Dänzer <mic...@daenzer.net>: > > > Anyway, I guess there's room for optimization in glReadPixels... > > 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. > > -Brina > 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 :-( 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. Regards, Ingo _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev