Apply depth range test and use gstate.isClearModeDepthWriteEnabled()