I first indicated the histogram (and blinkies apparently) was based on the RAW information but actually, Michael Reichmann (who was referenced in the aforementioned Pentax MF forum thread) said it is taken off the sensor (see excerpt below). The RAW file and the sensor may be two different things, I dunno, so, apologies for any confusion created.
https://luminous-landscape.com/pentax-645z-in-depth-review/
Fortunately the 645z has real-time highlight warning blinkies in Live View mode, and this is taken directly from the sensor. In other words, if something blinks red in Live View it’s blown. If it doesn’t, it isn’t. When displayed along with the histogram in Live View (which also has a red line to the right when anything is blown), you will be able to make technically optimum exposures. (Some experiments have shown that the camera’s real-time indication of “blown” coincides almost exactly with that of the histograms in Lightroom or Rawdigger.