Use gstate.isClearModeDepthWriteEnabled/ColorMask/AlphaMask()