It sounds like its not your ability that is in question here but your desire and motivation to actually do your job.
I suffered with depression for a few years and it started with me not having any enthusiasm for work, I was enjoying my work but I found dealing with people the main problem, I had to put on an act in work to be happy and chatty but I really just wanted to shut myself away and be left alone. I tried changing jobs and I'd always think it had made me happier but it was never long before I was back where I was before, dreading going to work and seeing people, I didn't know why I felt that way and eventually it got so bad that I wouldn't even see my family and i lost contact with all of my friends and stopped socialising, that was when I went to the doctor and they said I was suffering with depression, I've gone full circle since then and I love my work again as I realised that work wasn't the problem it was me, once I knew what was going on I found my own way to deal with it.
This may not be the same situation as you are currently going through but I can sympathise with how you are feeling. I didn't even realise I was suffering with depression, it hadn't even crossed my mind.
I hope you can figure out what is the best thing for you and I wish you all the luck in the world with whatever you do. It's worth remembering that somethings in life are sent to try us and if we face these things they make us stronger!