Hi rrock,
You have a toxic supervisor. Your supervisor should not be shouting at you, saying that you are dumb or threatening you, that is not appropriate or nor should you accept it. I wish you had a better supervisor and you you are totally justified in losing your motivation. Bad supervisors are not healthy for you or anyone else. Do you have a second supervisor you can talk with or another academic at the uni? You could also possibly try to get a new supervisor and your student handbook/ students union might be able to help.