hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
11.07k stars 664 forks source link

internal/graphicsdriver/directx: DXGI_ERROR_DEVICE_REMOVED / DXGI_ERROR_DEVICE_HUNG error with the DirectX12 driver #2198

Open hajimehoshi opened 2 years ago

hajimehoshi commented 2 years ago
2022/07/11 21:04:37 directx: ID3D12Device::CreateGraphicsPipelineState failed: HRESULT(2289696773): goroutine 1 [running, locked to thread]:
runtime/debug.Stack()
    runtime/debug/stack.go:24 +0x65
main.logErrorAndExit({0x8a77a0, 0xc00062a020}, 0xc000006a00)
    github.com/wasedaigo/rpgsnack-runtime/main.go:124 +0x3f
main.main()
    github.com/wasedaigo/rpgsnack-runtime/main.go:112 +0x3d3

Motherboard hewlett-packard 1998 Intel Core i5 4690 CPU @ 3.50GHz Intel(R) HD Graphics 4600 Ram 8gb System Type 64-bit

Reported by @wasedaigo

hajimehoshi commented 2 years ago

I feel like my usage of descriptor heaps is wrong...

hajimehoshi commented 2 years ago

I'll backport 42d5d91829bcd6dfc559ef53d7fa546f3119daa2 to v2.3 for approprite memory usages.

EDIT: Applying this is not so easy. Let's wait until an actual issue happens...

hajimehoshi commented 2 years ago

This still happens with alpha.9

directx: ID3D12Device::CreateGraphicsPipelineState failed: HRESULT(2289696773): goroutine 1 [running, locked to thread]:
runtime/debug.Stack()
    runtime/debug/stack.go:24 +0x65
main.logErrorAndExit({0x6c7a00, 0xc0000c2070}, 0xc0000cea10)
    github.com/wasedaigo/rpgsnack-runtime/main.go:124 +0x3f
main.main()
    github.com/wasedaigo/rpgsnack-runtime/main.go:112 +0x3d3
hajimehoshi commented 2 years ago

I reverted the fix c183555cc8985f8b9df80fb1bc9034e79ddc9fd5 as this didn't help the reporter's machine.

hajimehoshi commented 2 years ago

We would need an actual device if we want to fix this.

erexo commented 1 year ago

As described in #2485 I do have access to machine which has this problem

hajimehoshi commented 1 year ago

Thanks but I'm at lost what approach would be the best. DXGI_ERROR_DEVICE_HUNG seems a very notorious error.

Let me think.

hajimehoshi commented 1 year ago

https://www.makeuseof.com/windows-dxgi-error-device-hung-error/

This article recommends 1) stop overclocking if you already do, and/or 2) edit the registery, and so on. Unfortunately the user would have to take these approarches instead of Ebitengine. I'll investigate more.

hajimehoshi commented 1 year ago

/CC @wasedaigo

hajimehoshi commented 1 year ago

From @wasedaigo's report:

directx: ID3D12Device::CreateCommittedResource failed: HANDLE(2289696773)
goroutine 1 [running, locked to thread]:
runtime/debug.Stack()
    runtime/debug/stack.go:24 +0x65
main.logErrorAndExit({0xfb9780, 0xc000129340}, 0xc00018c9b0)
    github.com/wasedaigo/rpgsnack-runtime/main.go:125 +0x2c
main.main()
    github.com/wasedaigo/rpgsnack-runtime/main.go:119 +0x3c9
hajimehoshi commented 1 year ago

My current rough guess is that adopting DirectX 11 instead of DirectX 12 might improve the situation.

hajimehoshi commented 1 year ago

As this is pretty rare with the DirectX 11 (not 12) driver, I'll remove the milestone. I don't think this is fixable by me anyway.