the speed of readback from PBuffer?

Started by
1 comment, last by pango99 20 years, 6 months ago
Hello everyone,if you accuse me post same question again,you mistake me.I had found the reason of my program''s poor performance of reading data back:my program read data from PBuffer(Pixel Buffer) directly.I rewrite my program to read data from the front buffer(the buffer that store the image will be displayed in a window),the bandwidth is about 180Mbytes/sc,but I change to read data from PBuffer,the bandwidth dropped down to about 2.5Mbytes/sc.The difference make me surprise,why the read back speed of PBuffer is so slow?Is my test result right? I post my code of reading data from PBuffer and the creating of PBuffer,if there had some mistake,please let me know,thanks! //the code of reading data from Pbuffe pbuf.MakeCurrent();//my PBuffer class''s instance for (int i=0;i<100; i++) glReadPixels(0,0,512,512,GL_BGR_EXT,GL_UNSIGNED_BYTE,buf); //my pbuffer creating code: int iAttributes[]={ WGL_DRAW_TO_PBUFFER_ARB,TRUE, WGL_DEPTH_BITS_ARB,24, WGL_RED_BITS_ARB,8, WGL_GREEN_BITS_ARB,8, WGL_BLUE_BITS_ARB,8, WGL_ALPHA_BITS_ARB,8, WGL_BIND_TO_TEXTURE_RGBA_ARB,TRUE, 0,0}; float fAttributes[]={0,0}; GLint nPixelFmt; unsigned int nNumFmt; if(!wglChoosePixelFormatARB(wglGetCurrentDC(),iAttributes,fAttributes,1,&nPixelFmt,&nNumFmt)) return FALSE; int iFlag[]={ WGL_PBUFFER_LARGEST_ARB,TRUE, WGL_TEXTURE_FORMAT_ARB,WGL_TEXTURE_RGBA_ARB, WGL_TEXTURE_TARGET_ARB,WGL_TEXTURE_2D_ARB, 0,0 }; m_hPBuffer=wglCreatePbufferARB(wglGetCurrentDC(),nPixelFmt,width,height,iFlag); m_hdcPBuffer=wglGetPbufferDCARB(m_hPBuffer); m_hrcPBuffer=wglCreateContext(m_hdcPBuffer); BOOL bRet=wglMakeCurrent(m_hdcPBuffer,m_hrcPBuffer);
fsdf
Advertisement
quote:
pbuf.MakeCurrent();//my PBuffer class's instance
for (int i=0;i<100; i++)
glReadPixels(0,0,512,512,GL_BGR_EXT,GL_UNSIGNED_BYTE,buf);


The point of using a pbuffer is so that you dont have to read back to the client side memory, everything can be kept on the server side(GPU). Using readPixel on the frame buffer or a Pbuffer both copy data from the GPU to the client, you want to keep everything on the server..ie. dont use readPixel...maybe use copyImage (potentially one GPU to GPU copy) or render to Texture stuff(no copying at all), if you need to get the data back onto the CPU then your pretty much out of luck in terms of speed. also why are you reading back the pbuffer 100 times?...benchmarking purposes?

[edited by - _walrus on October 14, 2003 8:55:01 AM]
Yes,I readback pbuffer for 100 times just for benchmarking purpose,I want to know the bandwidth of readback.My program need to readback data from GPU every 0.04 seconds,if I read from frame buffer,everything is OK,but I read from PBuffer,the speed let me despire,I think the frame buffer and the pixel buffer are all the part of the memory installed in display card,and they all go through the same AGP bus,but why the bandwidth is so different?Is it the bug of driver?(I test my program in a Geforce FX5200 and a Ti4200)
fsdf

This topic is closed to new replies.

Advertisement