A Scanner Darkly (2006)

The video keeps buffering? Just pause it for 5-10 minutes then continue playing!

In a totalitarian society in a near future, the undercover detective Bob Arctor is working with a small time group of drug users trying to reach the big distributors of a brain-damaging drug called Substance D. His assignment is promoted by the recovery center New Path Corporation, and when Bob begins to lose his own identity and have schizophrenic behavior, he is submitted to tests to check his mental conditions.