Actually, if you look at Robin Williams repertoire of films, he does a lot of very depressing movies. Like the ratio of funny movies to depressing movies is extraordinarily lopsided.
The behind the scenes for 1 Hour Photo has perfectly normal Robin Williams goofing off and it's just jarring going from watching the really serious and depressing movie and just seeing him on the set goofing off and making everyone around laugh
Off the top of my head, What Dreams May Come and One Hour Photo are two wildly different types of movie, both kinda bleak in their own way, and neither what you'd turn to if you wanted a Robin Williams comedy. To some extent World's Greatest Dad as well, though that one actually is pretty funny.