Should GraphicsDevice be a global variable?

Hi, I’m just rearranging my game’s code a little bit as it had a lot of dependencies on one class. During this process, I’ve discovered that I was passing in the GraphicsDevice from my game class into almost every other class and realised it might be more efficient to just make it a global static instance.
I’ve heard that global variables are bad practice though so I’m just wondering if this is a good idea.

My opinion: Yes, no problem for a smaller project to keep a static reference to your ContentManager and GraphicsDeviceManager. My first project did this and it worked just fine. For a larger project consider using dependency injection so you don’t have to worry as much about passing things around.

I even make my game object be a global variable.

Personally, I’m not a fan of Dependency Injection except for some edge cases. I use a Global for my Graphics objects since they are part of the API and used no matter what the platform is.

If I had to use different Graphics objects for different platforms I might consider DI.