DXGI_ERROR_DEVICE_REMOVED error - SOLVED

Hello,

I can’t find a solution to this error message "DXGI_ERROR_DEVICE_REMOVED ". I don’t know why is it removed, and what should I do to avoid this error.

My game starts and I can run it as long as I want, but after I change the scale of my sprites and I try to call this line:
spriteTexture.GetData(0, new Rectangle((int)pixelPosition.X, (int)pixelPosition.Y, (1), (1)), PixelData, 0, 1);

to make a pixel check, I get this:

{HRESULT: [0x887A0005], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_DEVICE_REMOVED/DeviceRemoved], Message: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action.
}

at SharpDX.Result.CheckError()
at SharpDX.Direct3D11.Device.CreateTexture2D(Texture2DDescription& descRef, DataBox initialDataRef, Texture2D texture2DOut)
at SharpDX.Direct3D11.Texture2D…ctor(Device device, Texture2DDescription description)
at Microsoft.Xna.Framework.Graphics.Texture2D.PlatformGetData[T](Int32 level, Int32 arraySlice, Nullable1 rect, T[] data, Int32 startIndex, Int32 elementCount) in c:\PROJECT\ProgOrion\Projects\Animal Dominion\implementation\trunk\implementation\KingdomsOfFantasy_Library\MonoGame_Full\MonoGame.Framework\Graphics\Texture2D.DirectX.cs:line 125 at Microsoft.Xna.Framework.Graphics.Texture2D.GetData[T](Int32 level, Int32 arraySlice, Nullable1 rect, T data, Int32 startIndex, Int32 elementCount) in c:\PROJECT\ProgOrion\Projects\Animal Dominion\implementation\trunk\implementation\KingdomsOfFantasy_Library\MonoGame_Full\MonoGame.Framework\Graphics\Texture2D.cs:line 199
at Microsoft.Xna.Framework.Graphics.Texture2D.GetData[T](Int32 level, Nullable`1 rect, T data, Int32 startIndex, Int32 elementCount) in c:\PROJECT\ProgOrion\Projects\Animal Dominion\implementation\trunk\implementation\KingdomsOfFantasy_Library\MonoGame_Full\MonoGame.Framework\Graphics\Texture2D.cs:line 214
at KingdomsOfFantasy_WPF_Client.MonoGameMap.PixelCheck(Texture2D spriteTexture, Vector2 spritePosition, Vector2 spriteSize, Vector2 mousePosition) in C:\PROJECT\ProgOrion\Projects\Animal Dominion\implementation\trunk\implementation\KingdomsOfFantasy_Library\KingdomsOfFantasy_WPF_Client\MonoGameMap.cs:line 661
at KingdomsOfFantasy_WPF_Client.MonoGameMap.OnMouseOver(Vector2 mousePosition) in C:\PROJECT\ProgOrion\Projects\Animal Dominion\implementation\trunk\implementation\KingdomsOfFantasy_Library\KingdomsOfFantasy_WPF_Client\MonoGameMap.cs:line 634
at KingdomsOfFantasy_WPF_Client.MainWindow.RenderPanel_MouseMove(Object sender, MouseEventArgs e) in C:\PROJECT\ProgOrion\Projects\Animal Dominion\implementation\trunk\implementation\KingdomsOfFantasy_Library\KingdomsOfFantasy_WPF_Client\Windows\GameWindow.xaml.cs:line 1744
at System.Windows.Forms.Control.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at KingdomsOfFantasy_WPF_Client.App.Main() in C:\PROJECT\ProgOrion\Projects\Animal Dominion\implementation\trunk\implementation\KingdomsOfFantasy_Library\KingdomsOfFantasy_WPF_Client\obj\x86\Debug\XAML\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

I found a lot of threads on the internet with similar messages, even one ticket here on the monogame forum:

but he gave up in my opinion. Should I really downgrade my MonoGame version?

I have the latest drivers to my rig. (GTX 950, i7 6700K)

Do you have any idea? Any help is really appreciated,

Andris

Hi all!

I’ve got it! Unfortunately it wasn’t a problem around devices/drivers or monogame. My only problem was that I wanted to test pixels that were out of the size of the 2D sprite. (because of the scale change)

I hope this will help to somebody one day!

1 Like

It did - thank you for posting your solution!

1 Like