iDevGames Forums
What is the fastest way to blit a framebuffer to the iPhone screen? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: What is the fastest way to blit a framebuffer to the iPhone screen? (/thread-346.html)

Pages: 1 2


What is the fastest way to blit a framebuffer to the iPhone screen? - Rasterman - Feb 10, 2010 01:24 PM

I will be porting my games which use my custom 2d engine, so I only require one blit to the screen per frame, I currently use glDrawPixels for my final blit on Mac and it works great. Is this what I should also use on the iPhone? Thank you for any help Smile


What is the fastest way to blit a framebuffer to the iPhone screen? - warmi - Feb 10, 2010 01:35 PM

Rasterman Wrote:I will be porting my games which use my custom 2d engine, so I only require one blit to the screen per frame, I currently use glDrawPixels for my final blit on Mac and it works great. Is this what I should also use on the iPhone? Thank you for any help Smile

No such thing on the iPhone.

You gonna have to create a texture , updating it on every frame and rendering using screen sized quad.


What is the fastest way to blit a framebuffer to the iPhone screen? - AnotherJake - Feb 10, 2010 02:52 PM

I wouldn't use glDrawPixels on the Mac either. Texture uploading should be much faster using glTexSubImage2D. I haven't tried it on the iPhone, but I'd wager it's not very efficient.


What is the fastest way to blit a framebuffer to the iPhone screen? - Rasterman - Feb 10, 2010 03:02 PM

For a 1280x800 screen on a MacBook glDrawPixels takes 6.5ms to update the screen including a glFlush, its plenty fast on everything I have tested it on. I don't remember if I tested glTexSubImage2D when I did the glDrawPixels, but looks like I might now as I will have to make a version that uses that for iPhone. Are there any non-opengl ways to screen blit quickly?


What is the fastest way to blit a framebuffer to the iPhone screen? - OneSadCookie - Feb 10, 2010 03:15 PM

Nope.













(These words are just making the message long enough to get past the forum censor)


What is the fastest way to blit a framebuffer to the iPhone screen? - Rasterman - Feb 27, 2010 10:13 AM

Does anyone have any timing results on how fast, or slow I should say, it takes to do a full update with glTexSubImage2D or glTexImage2D? Any size texture is fine and I can extrapolate from there.

And what is the fastest texture format to upload in? Is it a 565 or 5551 format?


What is the fastest way to blit a framebuffer to the iPhone screen? - AnotherJake - Feb 27, 2010 10:27 AM

Rasterman Wrote:Does anyone have any timing results on how fast, or slow I should say, it takes to do a full update with glTexSubImage2D or glTexImage2D? Any size texture is fine and I can extrapolate from there.
Sorry I don't have any hard numbers for you, but glTexSubImage2D should be at least as fast and possibly faster than glTexImage2D because it shouldn't have to completely replace the storage, just modify it.

On the 565 vs 5551, for upload, I would imagine they'd be identical in terms of bandwidth because they're both 16 bits per pixel, so same amount of data needs to be shipped to graphics hardware.


What is the fastest way to blit a framebuffer to the iPhone screen? - Rasterman - Feb 27, 2010 01:58 PM

I read on a blog that glTexSubImage2D is significantly slower because it has to recopy the texture somehow, but they didn't say using what format or how much slower. Also I would think getting the exact pixel format is crucial as otherwise it will have to do per-pixel conversions rather than just a memory copy?


What is the fastest way to blit a framebuffer to the iPhone screen? - warmi - Feb 27, 2010 02:06 PM

Rasterman Wrote:I read on a blog that glTexSubImage2D is significantly slower because it has to recopy the texture somehow, but they didn't say using what format or how much slower. Also I would think getting the exact pixel format is crucial as otherwise it will have to do per-pixel conversions rather than just a memory copy?

Anytime you call glTexSubImage2D , the driver will swizzle whatever texture data you are submitting and there is no way to precook the data to avoid swizzling.


What is the fastest way to blit a framebuffer to the iPhone screen? - AnotherJake - Feb 27, 2010 02:12 PM

Rasterman Wrote:I read on a blog that glTexSubImage2D is significantly slower

[shrugs] I don't know. That is clearly in direct conflict of the information I've heard. It certainly would not be very hard to try both and measure.


What is the fastest way to blit a framebuffer to the iPhone screen? - Rasterman - Feb 27, 2010 02:39 PM

warmi Wrote:Anytime you call glTexSubImage2D , the driver will swizzle whatever texture data you are submitting and there is no way to precook the data to avoid swizzling.

what do you mean by swizzle?


What is the fastest way to blit a framebuffer to the iPhone screen? - warmi - Feb 27, 2010 02:41 PM

Rasterman Wrote:what do you mean by swizzle?

Convert it to its own internal format.


What is the fastest way to blit a framebuffer to the iPhone screen? - Rasterman - Feb 27, 2010 03:44 PM

is that because you can't issue a 565 format texture via glTexSubImage2D? or why not if its the same format as the internal format?


What is the fastest way to blit a framebuffer to the iPhone screen? - arekkusu - Feb 27, 2010 04:39 PM

Because your data isn't cache efficient for texture sampling.


What is the fastest way to blit a framebuffer to the iPhone screen? - Rasterman - Feb 28, 2010 03:08 PM

ah, swizzle, i remember now, where you pack a cluster of (16x16 pixels for example) into a memory aligned row, since when you are rendering you are stepping through the texture at any angle. got it. but even when you call glTexImage2D, isn't the whole texture swizzled?