Loading...

mac-opengl@lists.apple.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Texture Download Speed John Rosasco Mon Jul 28 11:00:54 2008

Use pixel buffer objects David. The method there is much more simple and foolproof. Bind the PBO for reading and issue a glReadPixels.

On Jul 28, 2008, at 8:23 AM, David Yamnitsky wrote:

Hi everyone,
I'm working on a project in which I have to load HD images onto the GPU, process them, and send them back to main memory all in about 8-10 milliseconds. Using the Apple OpenGL programming guide's tips on optimizing upload using extensions, I've managed to get upload speeds of between .9 and 1.2 milliseconds. I would expect to have similar speeds going the other way, but that hasn't been the case, it's been an order of magnitude greater. Am I doing something wrong? Here's my download code:

CGLContextObj cgl_ctx = [_context CGLContextObj];
_bitmapInfo.dataPtr = ptr;
glBindTexture(_textureInfo.texTarget, _textureInfo.texName);
glTexParameteri(_textureInfo.texTarget, GL_TEXTURE_STORAGE_HINT_APPLE,
GL_STORAGE_SHARED_APPLE);
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
glCopyTexSubImage2D(_textureInfo.texTarget,
0, 0, 0, 0, 0, _width, _height);
glFlush();
glGetTexImage(_textureInfo.texTarget, 0, GL_YCBCR_422_APPLE,
GL_UNSIGNED_SHORT_8_8_APPLE, _bitmapInfo.dataPtr);



And here's the upload code:

glGenTextures(1, &_textureInfo.texName);
glEnable (_textureInfo.texTarget);
glBindTexture(_textureInfo.texTarget, _textureInfo.texName);
glTexParameteri(_textureInfo.texTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(_textureInfo.texTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(_textureInfo.texTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(_textureInfo.texTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri (_textureInfo .texTarget,GL_TEXTURE_STORAGE_HINT_APPLE,GL_STORAGE_SHARED_APPLE);
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
glTexImage2D(_textureInfo.texTarget, 0, GL_RGBA, self.width, self.height, 0, GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, ptr);

As it turns out, the pointer that I download the texture to is the same pointer used to upload the texture, so I'm just rewriting the original data. Could this pose an issue with the UNPACK_CLIENT_STORAGE_APPLE extension? I haven't noticed it being an issue, but could it degrade performance?

Thanks in advance,
David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/jdr%40apple.com

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/alexiscircle%40gmail.com

This email sent to [EMAIL PROTECTED]