Actually I can't understand what was the actual reason for this issue. Then I checked the graphics driver, sometimes it may happen due to outdated the graphics driver and it was.
But I was getting the same issue after updating the graphics driver. Then I searched online and came across
this particular article. This article suggested what to do if the graphics card stopped working after updating. So I followed the entire article. First I enabled the graphics driver which was disabled and then reinstalled the graphics driver. After doing the tasks properly the problem got solved. Now I have no longer any issues while playing the game.