Hi all, I've been trying to track down a rendering issue in our application, and I'm considering z-fighting as a potential root cause. I've tracked the z-ordering logic from SurfaceFlinger.h down to LayerBase.cpp. Here are my findings, please correct me if I'm wrong:
SurfaceFlinger.h composites the layers in z-order, which is determined by the ViewParent classes. In the case that two elements have the same z-value their *sequence* is used as the comparison for ordering purposes. Sequence appears to be an attempt at a UID for each LayerBase instance. Sequence is initialized to an incremented sSequence, which is a static member of the LayerBase class. This guarantees that no two instances of LayerBase begin with the same sequence. So far so good. However each of the transformation operations within LayerBase, i.e. setAlpha, setPosition, etc. increment this sequence value. This means (as far as I understand) that I can create two LayerBase objects A and B, with sequence 1 and 2 respectively to begin with, and then do some sort of transformation onto A causing it to increment its sequence to 2 also. This could potentially result in a situation where A and B share the same z-order AND the same sequence, in which case ordering is not sane and z-fighting issues can occur. Am I correct in that assessment or am I completely misunderstanding this system? I'm completely new to Android so don't worry about hurting my feelings if I'm completely wrong. -- unsubscribe: [email protected] website: http://groups.google.com/group/android-porting
