Humm put it in this way also good performance 

if ((!gstate.isClearModeDepthMask() && gstate.isModeThrough()) || gstate.isModeClear())