Better performance using images with “opaque” property? Why?

The iPhone GPU is a tile-based renderer. If an overlaying layer is completely opaque over an entire tile, the GPU can ignore setting up and processing any graphics commands related to the layer underneath for that particular tile, in addition to not having to do compositing of the pixels in that tile.

The iPhone GPU is a tile-based renderer. If an overlaying layer is completely opaque over an entire tile, the GPU can ignore setting up and processing any graphics commands related to the layer underneath for that particular tile, in addition to not having to do compositing of the pixels in that tile. If your image doesn't cover a complete tile, the GPU will still have to potentially process multiple layers.

The size of a tile is implementation dependent, but tiny graphics images are far less likely to cover a tile. Huge images that cover multiple tiles will show the greatest advantage from being opaque.

From the View Programming Guide for iOS: Declare Views as Opaque Whenever Possible UIKit uses the opaque property of each view to determine whether the view can optimize compositing operations. Setting the value of this property to YES for a custom view tells UIKit that it does not need to render any content behind your view. Less rendering can lead to increased performance for your drawing code and is generally encouraged.

Of course, if you set the opaque property to YES, your view must fills its bounds rectangle completely with fully opaque content. Hotpaw2 points out the behind-the-scenes reason for this, which can be found in the OpenGL ES Programming Guide for iOS: Another advantage of deferred rendering is that it allows the GPU to perform hidden surface removal before fragments are processed. Pixels that are not visible are discarded without sampling textures or performing fragment processing, significantly reducing the calculations that the GPU must perform to render the tile.To gain the most benefit from this feature, draw as much of the frame with opaque content as possible and minimize use of blending, alpha testing, and the discard instruction in GLSL shaders.

Because the hardware performs hidden surface removal, it is not necessary for your application to sort primitives from front to back.

You get better performance when a view or layer is opaque than when it's not. If it's not opaque, the graphics system has to composite that layer with the layers below to produce the final image. If it is opaque, then it's just a matter of copying the pixels to the frame buffer.

A little tricky issue to be aware of is that UIImageView will reset the opaque property to FALSE any time the image property is changed to a new UIImage. You could explicitly check in your code and set the opaque property after any change to the image property, or you could extend UIImageView and provide you own implementation of setImage that sets opaque after calling the super setImage method. I only found out about this by accident.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions