14.7 Z buffering Texture Rectangles


14.7.1 Primitive Z

The texture rectangle has no Z value associated with it directly, however you can use the primitive Z register (g*DPSetPrimDepth()). To force the Z buffer logic to use primitive Z rather than pixel Z, you must use the following command:


You must also use a RenderMode that enables Z buffering, such as G_RM_ZB_OPA_SURF. To Z buffer sprite, you would have to insert a g*DPSetPrimDepth() command before the rectangle command of each sprite. Because the primitive Z is explicitly buffered in the pipeline, it is not necessary to insert pipe sync commands before setting the register.

Note that Z buffering can only be used in 1 and 2-cycle mode. In copy and fill mode, you should use the RenderMode G_RM_NOOP to effectively disable Z buffering and put the pipeline logic in a safe state.