Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeviceLost with D3D12 on Intel HD 4000 #849

Closed
MarekLg opened this issue Jul 28, 2020 · 40 comments · Fixed by #4709
Closed

DeviceLost with D3D12 on Intel HD 4000 #849

MarekLg opened this issue Jul 28, 2020 · 40 comments · Fixed by #4709
Labels
api: dx12 Issues with DX12 or DXGI external: driver-bug A driver is causing the bug, though we may still want to work around it

Comments

@MarekLg
Copy link

MarekLg commented Jul 28, 2020

I was trying this tutorial on my laptop but it does not run. The message is:

called Result::unwrap() on an Err value: DeviceLost

at ...\wgpu-core-0.5.6\src\device\life.rs:263.

My laptop is running Intel HD Graphics 4000, but it runs fine on my desktop with a GTX 1080. The issue still persists with examples from this repo.

@kvark
Copy link
Member

kvark commented Jul 28, 2020

Running any examples results in DeviceLost? I assume you are on Linux. Could you install the validation layers, and see if anything shows up when running the examples?

@MarekLg
Copy link
Author

MarekLg commented Jul 28, 2020

Yes, any tutorial results in this error.
I'm running Windows.
I will follow up with the results from the validation layers shortly.

Thank you for your time!

@MarekLg
Copy link
Author

MarekLg commented Jul 28, 2020

I used log level 'trace', but no additional information was provided (I followed this explanation).
Also I lied, the examples from the repo give another error message:

cube:

thread 'main' panicked at 'assertion failed: (left == right)
left: 0,
right: -2005270523', ...\gfx-backend-dx12-0.5.8\src\device.rs:1005:9

shadow / skybox:

thread 'main' panicked at 'assertion failed: (left == right)
left: 0,
right: -2005270523', ...\gfx-backend-dx12-0.5.8\src\device.rs:2199:9

@MarekLg
Copy link
Author

MarekLg commented Jul 28, 2020

It seems that Vulkan is not working on my end. Running the hello-example with BackendBit set to VULKAN result in

thread 'main' panicked at 'called Option::unwrap() on a None value', examples\hello\main.rs:4:19

and running it with BackendBit set to PRIMARY results in DirectX 12 being used:

AdapterInfo { name: "Intel(R) HD Graphics Family", vendor: 32902, device: 2582, device_type: IntegratedGpu, backend: Dx12 }

I will check my display driver, but do you have another idea what could be posing this problem?

@kvark
Copy link
Member

kvark commented Jul 28, 2020

Ok, that is expected. I thought you are on Linux/Vulkan because I know Windows doesn't support Vulkan on Intel 4000, but Linux does. There is nothing you can do about it. Now it's clear that your issue is in D3D12 backend.

Could you run the example from Visual Studio? See our wiki for information on how to get D3D12 debug output.

@MarekLg
Copy link
Author

MarekLg commented Jul 28, 2020

Good to know, thanks.

Running it in VS I get this message:

Exception thrown at 0x00007FFAD5363E49 in cube.exe: Microsoft C++ exception: ?? ::st_panic at memory location 0x0000007DC80FDF08.

and then a bunch of threads and the program itself exiting on code 101. Does this help?

@MarekLg
Copy link
Author

MarekLg commented Jul 28, 2020

Whoops, still was runnning on the vulkan backend. Now I get a whole lot of errors, I'll try to group them, so I don't post an endless wall of text.

@MarekLg
Copy link
Author

MarekLg commented Jul 28, 2020

Here is the shortened error message:

'cube.exe' (Win32): Loaded 'C:\Users\mlegr\Code.Ideas\Rust\wgpu-rs\target\debug\examples\cube.exe'. Symbols loaded.
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
...
'cube.exe' (Win32): Loaded 'C:\Windows\System32\setupapi.dll'.
Exception thrown at 0x00007FFAD5363E49 in cube.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x00000001000F5DE8.
'cube.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'.
...
'cube.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'.
onecore\windows\feedback\core\werdll\lib\securityattributes.cpp(452)\wer.dll!00007FFAD255D167: (caller: 00007FFAD256D50E) LogHr(1) tid(32c0) 8007109A This operation is only valid in the context of an app container.
[CSecurityAttributes::GetNewRestrictedFileOrDirectorySecurityAttributes]
'cube.exe' (Win32): Loaded 'C:\Windows\System32\netprofm.dll'.
...
'cube.exe' (Win32): Loaded 'C:\Windows\System32\cryptnet.dll'.
The thread 0xa64 has exited with code 0 (0x0).
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(571)\wer.dll!00007FFAD250F02F: (caller: 00007FFAD255B9FC) LogHr(2) tid(32c0) 80004001 Not implemented
Msg:[CReportStore::Prune: MaxReportCount=500 MaxSizeInMb=0] [CReportStore::Prune]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(653)\wer.dll!00007FFAD250F1A4: (caller: 00007FFAD255B9FC) LogHr(3) tid(32c0) 80004001 Not implemented
Msg:[Deleting report. Path: \?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_800705B4_5cde476b31632f45bbcccb6d1445f743d571f36b_00000000_fe73bd75-52fc-4bb4-86ac-5ce9abfcbe20] [CReportStore::Prune]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(1144)\wer.dll!00007FFAD2506F6B: (caller: 00007FFAD2523108) LogHr(4) tid(32c0) 80004001 Not implemented
Msg:[Report key is: '\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_800705B4_5cde476b31632f45bbcccb6d1445f743d571f36b_00000000_fe73bd75-52fc-4bb4-86ac-5ce9abfcbe20', subpath is 'NonCritical_800705B4_5cde476b31632f45bbcccb6d1445f743d571f36b_00000000_fe73bd75-52fc-4bb4-86ac-5ce9abfcbe20'] [CReportStore::StoreKeyToStorePathSafe]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(1102)\wer.dll!00007FFAD2523417: (caller: 00007FFAD250F1D6) ReturnHr(1) tid(32c0) 80070005 Access is denied.
[CReportStore::DeleteReportFromStore]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(710)\wer.dll!00007FFAD250F2C6: (caller: 00007FFAD255B9FC) LogHr(5) tid(32c0) 80070005 Access is denied.
[CReportStore::Prune]
...
onecore\windows\feedback\core\werdll\lib\securityattributes.cpp(452)\wer.dll!00007FFAD255D167: (caller: 00007FFAD255BB16) LogHr(375) tid(32c0) 8007109A This operation is only valid in the context of an app container.
[CSecurityAttributes::GetNewRestrictedFileOrDirectorySecurityAttributes]
The thread 0x2b4c has exited with code 0 (0x0).
The thread 0x32c0 has exited with code 0 (0x0).
D3D12: Removing Device.
D3D12 ERROR: ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_DEVICE_HUNG: The Device took an unreasonable amount of time to execute its commands, or the hardware crashed/hung. As a result, the TDR (Timeout Detection and Recovery) mechanism has been triggered. The current Device Context was executing commands when the hang occurred. The application may want to respawn and fallback to less aggressive use of the display hardware). [ EXECUTION ERROR gfx-rs/wgpu-rs#232: DEVICE_REMOVAL_PROCESS_AT_FAULT]
Exception thrown at 0x00007FFAD5363E49 in cube.exe: Microsoft C++ exception: _com_error at memory location 0x00000001000EFFE8.
Exception thrown at 0x00007FFAD5363E49 in cube.exe: Microsoft C++ exception: ?? ::st_panic at memory location 0x00000001000EFFD8.
D3D12 WARNING: Live ID3D12Device at 0x000001663039FF68, Refcount: 67 [ STATE_CREATION WARNING gfx-rs/wgpu-rs#274: LIVE_DEVICE]
D3D12 WARNING: Live ID3D12RootSignature at 0x0000016630387FA0, Refcount: 0, IntRef: 2 [ STATE_CREATION WARNING #577: LIVE_ROOTSIGNATURE]
D3D12 WARNING: Live ID3D12PipelineState at 0x000001663039B080, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #572: LIVE_PIPELINESTATE]
D3D12 WARNING: Live ID3D12PipelineState at 0x0000016632C9B470, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #572: LIVE_PIPELINESTATE]
D3D12 WARNING: Live ID3D12Resource at 0x0000016632C960F0, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Heap at 0x0000016632C95B20, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #579: LIVE_HEAP]
D3D12 WARNING: Live ID3D12Fence at 0x0000016632C97100, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING: Live ID3D12CommandQueue at 0x00000166303C6230, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #570: LIVE_COMMANDQUEUE]
D3D12 WARNING: Live ID3D12Fence at 0x00000166303C6810, Name: Internal D3D12 Debug Fence, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING: Live ID3D12CommandQueue at 0x000001663555D110, Refcount: 7, IntRef: 0 [ STATE_CREATION WARNING #570: LIVE_COMMANDQUEUE]
D3D12 WARNING: Live ID3D12Fence at 0x00000166303CB660, Name: Internal D3D12 Debug Fence, Refcount: 0, IntRef: 9 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING: Live IDXGISwapChain at 0x00000166355A1800, Refcount: 2 [ STATE_CREATION WARNING gfx-rs/wgpu-rs#275: LIVE_SWAPCHAIN]
D3D12 WARNING: Live ID3D12LifetimeTracker at 0x0000016635560330, Refcount: 2, IntRef: 0 [ STATE_CREATION WARNING #1164: LIVE_LIFETIMETRACKER]
D3D12 WARNING: Live ID3D12Fence at 0x0000016632CCE950, Name: Internal DXGI Fence, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING: Live ID3D12CommandAllocator at 0x0000016632CCEBC0, Name: Internal DXGI CommandAllocator, Refcount: 1, IntRef: 2 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING: Live ID3D12GraphicsCommandList at 0x00000166354E00B0, Name: Internal DXGI CommandList, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING: Live ID3D12GraphicsCommandList at 0x0000016632CA9810, Name: Internal DXGI CommandList (debug layer indirect), Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING: Live ID3D12Resource at 0x0000016635516FB0, Refcount: 3, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Heap at 0x000001663559EAC0, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #579: LIVE_HEAP]
D3D12 WARNING: Live ID3D12Resource at 0x00000166354F02F0, Refcount: 3, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Heap at 0x00000166355179A0, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #579: LIVE_HEAP]
D3D12 WARNING: Live ID3D12Resource at 0x00000166354F0CE0, Refcount: 3, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Heap at 0x000001663559F090, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #579: LIVE_HEAP]
D3D12 WARNING: Live ID3D12Fence at 0x00000166354E4FA0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING: Live ID3D12DescriptorHeap at 0x000001663555C9B0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #576: LIVE_DESCRIPTORHEAP]
D3D12 WARNING: Live ID3D12Fence at 0x0000016630397530, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING: Live ID3D12Resource at 0x0000016632CAF370, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Heap at 0x0000016632CAEDA0, Refcount: 1, IntRef: 4 [ STATE_CREATION WARNING #579: LIVE_HEAP]
D3D12 WARNING: Live ID3D12Resource at 0x0000016630397C40, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Resource at 0x0000016630398980, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Heap at 0x00000166303983B0, Refcount: 1, IntRef: 5 [ STATE_CREATION WARNING #579: LIVE_HEAP]
D3D12 WARNING: Live ID3D12Resource at 0x00000166303990F0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Resource at 0x0000016635530F40, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12CommandAllocator at 0x00000166355316B0, Refcount: 1, IntRef: 2 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING: Live ID3D12GraphicsCommandList at 0x0000016632CC57B0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING: Live ID3D12GraphicsCommandList at 0x00000166356E00B0, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING: Live ID3D12CommandAllocator at 0x0000016632CCB890, Refcount: 1, IntRef: 2 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
...
D3D12 WARNING: Live ID3D12CommandAllocator at 0x00000166358EDE00, Refcount: 1, IntRef: 2 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING: Live ID3D12GraphicsCommandList at 0x00000166359A4B70, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING: Live ID3D12GraphicsCommandList at 0x00000166359B4A90, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING: Live ID3D12Resource at 0x00000166359C0990, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Resource at 0x00000166359C1100, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12RootSignature at 0x00000166359C3B90, Refcount: 1, IntRef: 1 [ STATE_CREATION WARNING #577: LIVE_ROOTSIGNATURE]
D3D12 WARNING: Live ID3D12Resource at 0x0000016635A44520, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Resource at 0x0000016635A484F0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Resource at 0x0000016635A492D0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Resource at 0x00000166359C8AF0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12PipelineState at 0x00000166359F3B10, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #572: LIVE_PIPELINESTATE]
D3D12 WARNING: Live ID3D12Fence at 0x00000166410C80E0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
Exception thrown at 0x00007FFAD5363E49 in cube.exe: Microsoft C++ exception: ?? ::st_panic at memory location 0x00000001000FE398.
The thread 0x61c has exited with code 101 (0x65).
The thread 0xad4 has exited with code 101 (0x65).
The thread 0x26d4 has exited with code 101 (0x65).
The thread 0xfa8 has exited with code 101 (0x65).
The thread 0x28e8 has exited with code 101 (0x65).
The thread 0x2a24 has exited with code 101 (0x65).
The thread 0x1d94 has exited with code 101 (0x65).
The thread 0x3648 has exited with code 101 (0x65).
The thread 0x425c has exited with code 101 (0x65).
The thread 0x32a0 has exited with code 101 (0x65).
The thread 0x354 has exited with code 101 (0x65).
The thread 0x2638 has exited with code 101 (0x65).
The thread 0x2808 has exited with code 101 (0x65).
D3D12 WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Producer at 0x000001663039FF48, Refcount: 64. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x0000016630387FA0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
...
D3D12 WARNING: Live Object at 0x00000166410C80E0, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object : 101 [ STATE_CREATION WARNING #0: UNKNOWN]
DXGI WARNING: Live Producer at 0x000001663039EFF8, Refcount: 9. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x000001663039F320, Refcount: 1. [ STATE_CREATION WARNING #0: ]
...
DXGI WARNING: Live Object at 0x0000016635550170, Refcount: 1. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object : 7 [ STATE_CREATION WARNING #0: ]
The program '[14248] cube.exe' has exited with code 101 (0x65).

I hope that helps...

@kvark
Copy link
Member

kvark commented Jul 29, 2020

Thank you for these logs! Strangely, they don't explain what's actually happening there.

Could you try running any D3D12 apps, or even gfx-rs's quad example?

git clone https://github.com/gfx-rs/gfx
cd gfx/examples
cargo run --features dx12 --bin quad

@MarekLg
Copy link
Author

MarekLg commented Jul 29, 2020

I ran the quad example.
Cargo run gave a 'no response' black window and the following console output:

AdapterInfo { name: "Intel(R) HD Graphics Family", vendor: 32902, device: 2582, device_type: IntegratedGpu }
AdapterInfo { name: "Microsoft Basic Render Driver", vendor: 5140, device: 140, device_type: VirtualGpu }
Memory types: [MemoryType { properties: DEVICE_LOCAL, heap_index: 0 }, MemoryType { properties: DEVICE_LOCAL | CPU_VISIBLE | COHERENT | CPU_CACHED, heap_index: 0 }, MemoryType { properties: DEVICE_LOCAL | CPU_VISIBLE | COHERENT | CPU_CACHED, heap_index: 0 }]
formats: Some([Bgra8Srgb, Bgra8Unorm, Rgba8Srgb, Rgba8Unorm, A2b10g10r10Unorm, Rgba16Sfloat])
SwapchainConfig { present_mode: FIFO, composite_alpha_mode: OPAQUE, format: Bgra8Srgb, extent: Extent2D { width: 1024, height: 768 }, image_count: 3, image_layers: 1, image_usage: COLOR_ATTACHMENT }

and nothing else until I forcefully closed the window.

Running the .exe in VS gives this error message:

'quad.exe' (Win32): Loaded 'C:\Users\mlegr\Code.Ideas\Rust\gfx\target\debug\quad.exe'. Symbols loaded.
'quad.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
...
'quad.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'.
D3D12 WARNING: ID3D12CommandList::IASetVertexBuffers: Resource 0x00000260F60B13B0:'Unnamed ID3D12Resource Object' and 1 other resources contain the GPU Virtual Address range [0x0000000075eae000, 0x0000000075eae05f] on a Heap (0x00000260F60B3C50:'Unnamed ID3D12Heap Object'). This may be OK as long as all of these resources are in the same state however developer probably did not intend to make use of this behavior. [ STATE_CREATION WARNING #926: HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS]
'quad.exe' (Win32): Loaded 'C:\Windows\System32\wer.dll'.
...
'quad.exe' (Win32): Loaded 'C:\Windows\System32\setupapi.dll'.
Exception thrown at 0x00007FFAD5363E49 in quad.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0000007C42B988F8.
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'.
...
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'.
onecore\windows\feedback\core\werdll\lib\securityattributes.cpp(452)\wer.dll!00007FFAD255D167: (caller: 00007FFAD256D50E) LogHr(1) tid(4d6c) 8007109A This operation is only valid in the context of an app container.
[CSecurityAttributes::GetNewRestrictedFileOrDirectorySecurityAttributes]
'quad.exe' (Win32): Loaded 'C:\Windows\System32\netprofm.dll'.
...
'quad.exe' (Win32): Loaded 'C:\Windows\System32\cryptnet.dll'.
The thread 0x25d4 has exited with code 0 (0x0).
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(571)\wer.dll!00007FFAD250F02F: (caller: 00007FFAD255B9FC) LogHr(2) tid(4d6c) 80004001 Not implemented
Msg:[CReportStore::Prune: MaxReportCount=500 MaxSizeInMb=0] [CReportStore::Prune]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(653)\wer.dll!00007FFAD250F1A4: (caller: 00007FFAD255B9FC) LogHr(3) tid(4d6c) 80004001 Not implemented
Msg:[Deleting report. Path: \?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_800705B4_5cde476b31632f45bbcccb6d1445f743d571f36b_00000000_fe73bd75-52fc-4bb4-86ac-5ce9abfcbe20] [CReportStore::Prune]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(1144)\wer.dll!00007FFAD2506F6B: (caller: 00007FFAD2523108) LogHr(4) tid(4d6c) 80004001 Not implemented
Msg:[Report key is: '\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_800705B4_5cde476b31632f45bbcccb6d1445f743d571f36b_00000000_fe73bd75-52fc-4bb4-86ac-5ce9abfcbe20', subpath is 'NonCritical_800705B4_5cde476b31632f45bbcccb6d1445f743d571f36b_00000000_fe73bd75-52fc-4bb4-86ac-5ce9abfcbe20'] [CReportStore::StoreKeyToStorePathSafe]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(1102)\wer.dll!00007FFAD2523417: (caller: 00007FFAD250F1D6) ReturnHr(1) tid(4d6c) 80070005 Access is denied.
[CReportStore::DeleteReportFromStore]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(710)\wer.dll!00007FFAD250F2C6: (caller: 00007FFAD255B9FC) LogHr(5) tid(4d6c) 80070005 Access is denied.
[CReportStore::Prune]
...
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(653)\wer.dll!00007FFAD250F1A4: (caller: 00007FFAD255B9FC) LogHr(375) tid(4d6c) 80004001 Not implemented
Msg:[Deleting report. Path: \?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_0_9b8c163c34a1417c6c6ee8e1442f31b6dc52b88_00000000_cab_9321035b-ef2a-4863-bc85-b61766afe103] [CReportStore::Prune]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(1144)\wer.dll!00007FFAD2506F6B: (caller: 00007FFAD2523108) LogHr(376) tid(4d6c) 80004001 Not implemented
Msg:[Report key is: '\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_0_9b8c163c34a1417c6c6ee8e1442f31b6dc52b88_00000000_cab_9321035b-ef2a-4863-bc85-b61766afe103', subpath is 'NonCritical_0_9b8c163c34a1417c6c6ee8e1442f31b6dc52b88_00000000_cab_9321035b-ef2a-4863-bc85-b61766afe103'] [CReportStore::StoreKeyToStorePathSafe]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(1102)\wer.dll!00007FFAD2523417: (caller: 00007FFAD250F1D6) ReturnHr(125) tid(4d6c) 80070005 Access is denied.
[CReportStore::DeleteReportFromStore]
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(710)\wer.dll!00007FFAD250F2C6: (caller: 00007FFAD255B9FC) LogHr(377) tid(4d6c) 80070005 Access is denied.
[CReportStore::Prune]
onecore\windows\feedback\core\werdll\lib\securityattributes.cpp(452)\wer.dll!00007FFAD255D167: (caller: 00007FFAD255BB16) LogHr(378) tid(4d6c) 8007109A This operation is only valid in the context of an app container.
[CSecurityAttributes::GetNewRestrictedFileOrDirectorySecurityAttributes]
The thread 0x2618 has exited with code 0 (0x0).
The thread 0x4d6c has exited with code 0 (0x0).
D3D12: Removing Device.
D3D12 ERROR: ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_DEVICE_HUNG: The Device took an unreasonable amount of time to execute its commands, or the hardware crashed/hung. As a result, the TDR (Timeout Detection and Recovery) mechanism has been triggered. The current Device Context was executing commands when the hang occurred. The application may want to respawn and fallback to less aggressive use of the display hardware). [ EXECUTION ERROR gfx-rs/wgpu-rs#232: DEVICE_REMOVAL_PROCESS_AT_FAULT]
Exception thrown at 0x00007FFAD5363E49 in quad.exe: Microsoft C++ exception: _com_error at memory location 0x0000007C42B9A3D8.
Exception thrown at 0x00007FFAD5363E49 in quad.exe: Microsoft C++ exception: _com_error at memory location 0x0000007C42B9A520.
Exception thrown at 0x00007FFAD5363E49 in quad.exe: Microsoft C++ exception: _com_error at memory location 0x0000007C42B9A670.
D3D12 WARNING: ID3D12CommandList::IASetVertexBuffers: Resource 0x00000260F60B13B0:'Unnamed ID3D12Resource Object' and 1 other resources contain the GPU Virtual Address range [0x0000000075eae000, 0x0000000075eae05f] on a Heap (0x00000260F60B3C50:'Unnamed ID3D12Heap Object'). This may be OK as long as all of these resources are in the same state however developer probably did not intend to make use of this behavior. [ STATE_CREATION WARNING #926: HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS]
D3D12 WARNING: ID3D12CommandList::IASetVertexBuffers: Resource 0x00000260F60B13B0:'Unnamed ID3D12Resource Object' and 1 other resources contain the GPU Virtual Address range [0x0000000075eae000, 0x0000000075eae05f] on a Heap (0x00000260F60B3C50:'Unnamed ID3D12Heap Object'). This may be OK as long as all of these resources are in the same state however developer probably did not intend to make use of this behavior. [ STATE_CREATION WARNING #926: HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS]
The thread 0x14ec has exited with code -1073741510 (0xc000013a).
...
The thread 0x3d88 has exited with code -1073741510 (0xc000013a).
D3D12 WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Producer at 0x00000260F0D5DDA8, Refcount: 43. [ STATE_CREATION WARNING #0: UNKNOWN]
...
D3D12 WARNING: Live Object at 0x00000260FFB43460, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object : 63 [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Producer at 0x00000260F0DA8AB8, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x00000260F5F900F0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
...
D3D12 WARNING: Live Object at 0x00000260F5FF45D0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object : 8 [ STATE_CREATION WARNING #0: UNKNOWN]
DXGI WARNING: Live Producer at 0x00000260F0D86B48, Refcount: 10. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x00000260F0D878E0, Refcount: 1. [ STATE_CREATION WARNING #0: ]
...
DXGI WARNING: Live Object at 0x00000260FFB97510, Refcount: 1. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object : 7 [ STATE_CREATION WARNING #0: ]
The program '[1208] quad.exe' has exited with code -1073741510 (0xc000013a).

@MarekLg
Copy link
Author

MarekLg commented Jul 29, 2020

Quick update: I tried running the wgu-rs examples with DX11 and it ran fine, so at least that's a workaround. No other backend works..
It seems like my HD 4000 is not compatible with DX12, even though dxdiag shows DX12 as being installed..

@kvark
Copy link
Member

kvark commented Jul 29, 2020

I'd like to know more about the problem. We can't easily abandon D3D12 for HD 4000 family on Windows, since it doesn't support Vulkan either. Something must tell us what's going on there...

@kvark kvark transferred this issue from gfx-rs/wgpu-rs Jul 29, 2020
@MarekLg
Copy link
Author

MarekLg commented Jul 29, 2020

I'm happy to help wherever I can! Just tell me what you need.

@kvark
Copy link
Member

kvark commented Jul 29, 2020

I found out that HD Graphics 4000 is an IvyBridge chip, and it's not meant to support DX12 at all (starts with Haswell).
The question is, therefore, what feature level your driver reports to us, and why it's trying to pretend it has support. I see that we are currently requesting Level 11_0, so that's probably why device creation succeeds....

Perhaps you could try running the gfx-rs's compute example too?

@kvark
Copy link
Member

kvark commented Jul 29, 2020

Another thing, this exception needs to be investigated in detail:

Exception thrown at 0x00007FFAD5363E49 in quad.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0000007C42B988F8.

@MarekLg
Copy link
Author

MarekLg commented Jul 29, 2020

Running the gfx-rs compute example like this:

...\gfx\examples> cargo run --bin compute --features dx12 1 2 3 4

gave me this output

Times: [0, 1, 7, 2]

and no errors

@kvark
Copy link
Member

kvark commented Jul 29, 2020

ok, great. So it's not that DX12 is not supported, but rather that the support is very limited. It could be that we are trying to do something that assumes a higher feature level than 11_0 without realizing it, and the driver goes nuts.

@cwfitzgerald
Copy link
Member

cwfitzgerald commented Jul 29, 2020

DX is weird like that, it lets you use higher versions of the API with lower feature levels as long as you don't try to use the features. If we find a backend that only supports 11_0, we should only count it as a DX11 backend, and ignore the 12. Not sure how the details of that will work.

@kvark
Copy link
Member

kvark commented Jul 30, 2020

That's certainly one valid way to address this, thanks to the fact we have a DX11 backend. However, it needs much more work before it can be usable, so there is a certain value in trying to get even 11_0 feature level in DX12 backend to work correctly.

@GenRythm
Copy link

Seems like I have the same problem like this.

My old laptop has the Nvidia GT 720m
AdapterInfo { name: "NVIDIA GeForce GT 720M", vendor: 4318, device: 4416, device_type: DiscreteGpu, backend: Dx12 }
But the feature level is only 11_0.

Run the DX12 backend always crashes with this

error: process didn't exit successfully: `target\debug\examples\cube.exe` (exit code: 0xc000041d)

If I set backend to DX11, it doesn't crash anymore but nothing shows up.

Do we have any help with this old stuff?

@kvark
Copy link
Member

kvark commented Aug 23, 2020

Since we don't have the hardware/platform to reproduce this, it would help if you could try figuring out the problem on your own. Running from Visual Studio should give you the debug messages, call stacks, etc. I'm curious to see where we are not handling this properly.

@GenRythm
Copy link

Running the cube.exe in VS and there are many error logs:

D3D11 ERROR: ID3D11DeviceContext::CSSetUnorderedAccessViews: On devices created at a Feature Level D3D_FEATURE_LEVEL_11_0, the maximum Compute Shader Unordered Access View slot is 7 (Offset 0 and NumViews 16 specified). [ STATE_SETTING ERROR #2097404: DEVICE_CSSETUNORDEREDACCESSVIEWS_TOOMANYVIEWS]

Searching around I found similar problem at: bkaradzic/bgfx#1484

As the workaround mentioned, I changed something with CSSetUnorderedAccessViews from 16 to 8 at

Then run the cube example again.
The error log is gone but still nothing shows up.
Output from VS has nothing special

Output
'cube.exe' (Win32): Loaded 'C:\Users\genrythm\workplace\projects\rust\wgpu-rs\target\debug\examples\cube.exe'. Symbols loaded.
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.19551.1001_none_79011ac43ef8608a\comctl32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\D3DCompiler_47.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\cryptsp.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\clbcatq.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DataExchange.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\d3d11.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\dcomp.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\dxgi.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\twinapi.appcore.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ResourcePolicyClient.dll'. 
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\ResourcePolicyClient.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvinitx.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. 
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\version.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvinitx.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvinitx.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. 
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\version.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvinitx.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvldumdx.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\crypt32.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\wintrust.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\msasn1.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\imagehlp.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\rsaenh.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvwgf2umx.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\winmm.dll'. 
The thread 0x542c has exited with code 0 (0x0).
'cube.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\wldp.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. 
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\winmm.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvwgf2umx.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\version.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvldumdx.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvldumdx.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvwgf2umx.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\winmm.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DXCore.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. 
The thread 0x5c98 has exited with code 0 (0x0).
The thread 0x5fd4 has exited with code 0 (0x0).
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\winmm.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvwgf2umx.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\version.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvldumdx.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\igd10iumd64.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ncrypt.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ntasn1.dll'. 
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\ntasn1.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\ncrypt.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\igd10iumd64.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\igd10iumd64.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ncrypt.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ntasn1.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\igdusc64.dll'. 
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\igdusc64.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\ntasn1.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\ncrypt.dll'
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\igd10iumd64.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\d3d10warp.dll'. 
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\d3d10warp.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\d3d10warp.dll'. 
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\d3d10warp.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvldumdx.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvwgf2umx.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\winmm.dll'. 
'cube.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvldumdx.dll'
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DXGIDebug.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_c73643c8a6190037\nvldumdx.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\d3d11_3SDKLayers.dll'. 
The thread 0x49fc has exited with code 0 (0x0).
'cube.exe' (Win32): Loaded 'C:\Windows\System32\igd10iumd64.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ncrypt.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\ntasn1.dll'. 
'cube.exe' (Win32): Loaded 'C:\Windows\System32\igdusc64.dll'. 

I'm very new to graphic and also Rust. I have no idea what it is and how it work.
So please help.
If you need me to run something with this device, please tell me.

Thank you.

@kvark
Copy link
Member

kvark commented Aug 26, 2020

I think we should investigate/fix the original issue with DX12 backend on that feature level.
Fixing D3D11 is nice, but it's less important.

@GenRythm
Copy link

Ok. I will dig into the dx12 backend.

@PeterHatch
Copy link

I'm having roughly the same issue (drawing doesn't work with the dx12 backend) with an Intel HD 4200, which supports feature level 11_1.

In particular, running the gfx quad example (cargo run --bin quad --features dx12) gives the following output:

AdapterInfo { name: "Intel(R) HD Graphics Family", vendor: 32902, device: 2590, device_type: IntegratedGpu }
AdapterInfo { name: "Microsoft Basic Render Driver", vendor: 5140, device: 140, device_type: VirtualGpu }
Memory types: [MemoryType { properties: DEVICE_LOCAL, heap_index: 0 }, MemoryType { properties: DEVICE_LOCAL | CPU_VISIBLE | COHERENT | CPU_CACHED, heap_index: 0 }, MemoryType { properties: DEVICE_LOCAL | CPU_VISIBLE | COHERENT | CPU_CACHED, heap_index: 0 }]
formats: Some([Bgra8Srgb, Bgra8Unorm, Rgba8Srgb, Rgba8Unorm, A2b10g10r10Unorm, Rgba16Sfloat])
SwapchainConfig { present_mode: FIFO, composite_alpha_mode: OPAQUE, format: Bgra8Srgb, extent: Extent2D { width: 1024, height: 768 }, image_count: 3, image_layers: 1, image_usage: COLOR_ATTACHMENT }
[2020-09-01T21:19:08Z ERROR gfx_backend_dx12::command] Undefined user data element in the root signature at 0
error: process didn't exit successfully: `C:\Projects\Rust\From Github\gfx\target\debug\quad.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

Running in Visual Studio, the debug output (excluding DLL loading/unloading messages) is:

[...]
Exception thrown at 0x00007FF95EAEA719 in quad.exe: Microsoft C++ exception: _com_error at memory location 0x00000073BBDC5C20.
[...]
D3D12 WARNING: ID3D12CommandList::IASetVertexBuffers: Resource 0x0000017B64801490:'Unnamed ID3D12Resource Object' and 1 other resources contain the GPU Virtual Address range [0x0000000075eae000, 0x0000000075eae05f] on a Heap (0x0000017B648555F0:'Unnamed ID3D12Heap Object').  This may be OK as long as all of these resources are in the same state however developer probably did not intend to make use of this behavior. [ STATE_CREATION WARNING #926: HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS]
D3D12 ERROR: CGraphicsCommandList::SetGraphicsRootDescriptorTable: The currently set root signature declares parameter [2] as a descriptor table in a descriptor heap of type D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, but the specified BaseDescriptor parameter is from a different descriptor heap type: D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV. [ EXECUTION ERROR #708: SET_DESCRIPTOR_TABLE_INVALID]
Exception thrown at 0x00007FF8FC13A221 (igd12umd64.dll) in quad.exe: 0xC0000005: Access violation reading location 0x0000000074000008.

@kvark
Copy link
Member

kvark commented Sep 1, 2020

[2020-09-01T21:19:08Z ERROR gfx_backend_dx12::command] Undefined user data element in the root signature at 0
D3D12 ERROR: CGraphicsCommandList::SetGraphicsRootDescriptorTable: The currently set root signature declares parameter [2] as a descriptor table in a descriptor heap of type D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, but the specified BaseDescriptor parameter is from a different descriptor heap type: D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV. [ EXECUTION ERROR #708: SET_DESCRIPTOR_TABLE_INVALID]

That's quite actionable, thank you!

@kvark kvark added the type: bug Something isn't working label Sep 1, 2020
@kvark
Copy link
Member

kvark commented Sep 2, 2020

@PeterHatch this was a different issue (affecting more than just Intel HD 4000), is about to be fixed in gfx-rs/gfx#3360 . Sorry about the inconvenience!

bors bot added a commit to gfx-rs/gfx that referenced this issue Sep 2, 2020
3360: [dx12] fix root signature indexing r=kvark a=kvark

Fixes a critical problem reported in gfx-rs/wgpu#849 (comment)
It appears to be a regression from #3342, where I accidentally started using the root offsets where the root indices are expected. We might need to change their types to not hit this any more times (maybe in d3d12-rs even? cc @msiglreith ).
PR checklist:
- [ ] `make` succeeds (on *nix)
- [ ] `make reftests` succeeds
- [x] tested examples with the following backends: D3D12


Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
@PeterHatch
Copy link

PeterHatch commented Sep 15, 2020

Okay, I'm now much closer to the same issue others reported - nothing drawn in the window, and it hangs.

Command line output, with RUST_LOG=trace
AdapterInfo { name: "Microsoft Basic Render Driver", vendor: 5140, device: 140, device_type: VirtualGpu }
[2020-09-15T19:30:25Z INFO  gfx_backend_dx12::device] create_descriptor_pool with 1 max sets
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::device]   content SRV
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::device]   content SAMPLER
[2020-09-15T19:30:25Z INFO  gfx_backend_dx12::device] total 1 views and 1 samplers
[2020-09-15T19:30:25Z INFO  gfx_backend_dx12::resource] allocate_set
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::resource]         binding DescriptorSetLayoutBinding { binding: 0, ty: Image { ty: Sampled { with_sampler: false } }, count: 1, stage_flags: FRAGMENT, immutable_samplers: false } with content SRV
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::resource]         view handles: 1
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::resource]         binding DescriptorSetLayoutBinding { binding: 1, ty: Sampler, count: 1, stage_flags: FRAGMENT, immutable_samplers: false } with content SAMPLER
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::resource]         sampler handles: 1
Memory types: [MemoryType { properties: DEVICE_LOCAL, heap_index: 0 }, MemoryType { properties: DEVICE_LOCAL | CPU_VISIBLE | COHERENT | CPU_CACHED, heap_index: 0 }, MemoryType { properties: DEVICE_LOCAL | CPU_VISIBLE | COHERENT | CPU_CACHED, heap_index: 0 }]
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::device] write_descriptor_sets
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::device]   DescriptorBindingInfo { count: 1, view_range: Some(DescriptorRange { handle: DualHandle, ty: Image { ty: Sampled { with_sampler: false } }, handle_size: 128, count: 1 }), sampler_range: None, dynamic_descriptors: UnsafeCell, content: SRV } binding 0 array offset 0
[2020-09-15T19:30:25Z TRACE gfx_backend_dx12::device]   srv offset 0
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::device]   DescriptorBindingInfo { count: 1, view_range: None, sampler_range: Some(DescriptorRange { handle: DualHandle, ty: Sampler, handle_size: 128, count: 1 }), dynamic_descriptors: UnsafeCell, content: SAMPLER } binding 1 array offset 0
[2020-09-15T19:30:25Z TRACE gfx_backend_dx12::device]   sampler offset 0
formats: Some([Bgra8Srgb, Bgra8Unorm, Rgba8Srgb, Rgba8Unorm, A2b10g10r10Unorm, Rgba16Sfloat])
SwapchainConfig { present_mode: FIFO, composite_alpha_mode: OPAQUE, format: Bgra8Srgb, extent: Extent2D { width: 1024, height: 768 }, image_count: 3, image_layers: 1, image_usage: COLOR_ATTACHMENT }
[2020-09-15T19:30:25Z INFO  gfx_backend_dx12::device] Creating a pipeline layout with 1 sets and 1 root constants
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::device]   Root constant set=0 range 0..2
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::device]   Range DescriptorSetLayoutBinding { binding: 0, ty: Image { ty: Sampled { with_sampler: false } }, count: 1, stage_flags: FRAGMENT, immutable_samplers: false } at space=1
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::device]   Range DescriptorSetLayoutBinding { binding: 1, ty: Sampler, count: 1, stage_flags: FRAGMENT, immutable_samplers: false } at space=1
[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::device] SPIRV-Cross generated shader:
    #ifndef SPIRV_CROSS_CONSTANT_ID_0
    #define SPIRV_CROSS_CONSTANT_ID_0 0.800000011920928955078125f
    #endif
    static const float scale = SPIRV_CROSS_CONSTANT_ID_0;

    static float4 gl_Position;
    static float2 v_uv;
    static float2 a_uv;
    static float2 a_pos;

    struct SPIRV_Cross_Input
    {
        float2 a_pos : TEXCOORD0;
        float2 a_uv : TEXCOORD1;
    };

    struct SPIRV_Cross_Output
    {
        float2 v_uv : TEXCOORD0;
        float4 gl_Position : SV_Position;
    };

    void vert_main()
    {
        v_uv = a_uv;
        gl_Position = float4(a_pos * scale, 0.0f, 1.0f);
        gl_Position.y = -gl_Position.y;
    }

    SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
    {
        a_uv = stage_input.a_uv;
        a_pos = stage_input.a_pos;
        vert_main();
        SPIRV_Cross_Output stage_output;
        stage_output.gl_Position = gl_Position;
        stage_output.v_uv = v_uv;
        return stage_output;
    }

[2020-09-15T19:30:25Z DEBUG gfx_backend_dx12::device] SPIRV-Cross generated shader:
    Texture2D<float4> u_texture : register(t0, space1);
    SamplerState u_sampler : register(s1, space1);

    static float4 target0;
    static float2 v_uv;

    struct SPIRV_Cross_Input
    {
        float2 v_uv : TEXCOORD0;
    };

    struct SPIRV_Cross_Output
    {
        float4 target0 : SV_Target0;
    };

    void frag_main()
    {
        target0 = u_texture.Sample(u_sampler, v_uv);
    }

    SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
    {
        v_uv = stage_input.v_uv;
        frag_main();
        SPIRV_Cross_Output stage_output;
        stage_output.target0 = target0;
        return stage_output;
    }

[2020-09-15T19:30:25Z ERROR gfx_backend_dx12::command] Undefined user data element in the root signature at 0
[2020-09-15T19:30:27Z ERROR gfx_backend_dx12::command] Undefined user data element in the root signature at 0
[2020-09-15T19:30:30Z ERROR gfx_backend_dx12::command] Undefined user data element in the root signature at 0
error: process didn't exit successfully: `C:\Projects\Rust\From Github\gfx\target\debug\quad.exe` (exit code: 0xcfffffff)
Visual Studio output
'quad.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.18362.1016_none_73b3274ad815f571\comctl32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\D3DCompiler_47.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\cryptsp.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\profapi.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\powrprof.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\umpdc.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\vcruntime140.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\iertutil.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\oleacc.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\clbcatq.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\DataExchange.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\d3d11.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\dcomp.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\dxgi.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\DXCore.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\twinapi.appcore.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\rmclient.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\D3D12.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\d3d12SDKLayers.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\DXGIDebug.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\DXGIDebug.dll'
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\d3d12SDKLayers.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\DXGIDebug.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\ResourcePolicyClient.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\ResourcePolicyClient.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\igd12umd64.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\d3d12SDKLayers.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\igdusc64.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\d3d10warp.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\dxilconv.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\D3DSCache.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\userenv.dll'. 
Exception thrown at 0x00007FF95EAEA719 in quad.exe: Microsoft C++ exception: _com_error at memory location 0x000000B5A2325D40.
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\dxilconv.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\dxilconv.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\rsaenh.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. 
D3D12 WARNING: ID3D12CommandList::IASetVertexBuffers: Resource 0x00000238EDD1C9B0:'Unnamed ID3D12Resource Object' and 1 other resources contain the GPU Virtual Address range [0x0000000075eae000, 0x0000000075eae05f] on a Heap (0x00000238F87B2A40:'Unnamed ID3D12Heap Object').  This may be OK as long as all of these resources are in the same state however developer probably did not intend to make use of this behavior. [ STATE_CREATION WARNING #926: HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS]
D3D12: Removing Device.
D3D12 ERROR: ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_DEVICE_HUNG: The Device took an unreasonable amount of time to execute its commands, or the hardware crashed/hung. As a result, the TDR (Timeout Detection and Recovery) mechanism has been triggered. The current Device Context was executing commands when the hang occurred. The application may want to respawn and fallback to less aggressive use of the display hardware). [ EXECUTION ERROR #232: DEVICE_REMOVAL_PROCESS_AT_FAULT]
'quad.exe' (Win32): Loaded 'C:\Windows\System32\wer.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\aepic.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\sfc.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\sfc.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\sfc.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\sfc_os.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\setupapi.dll'. 
Exception thrown at 0x00007FF95EAEA719 in quad.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x000000B5A2329710.
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msvcp110_win.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\msvcp110_win.dll'
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msvcp110_win.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\msvcp110_win.dll'
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msvcp110_win.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\msvcp110_win.dll'
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msvcp110_win.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\msvcp110_win.dll'
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msvcp110_win.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\msvcp110_win.dll'
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msvcp110_win.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\msvcp110_win.dll'
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\netapi32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\dsreg.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msvcp110_win.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\crypt32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\msasn1.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\xmllite.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\FlightSettings.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\winhttp.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\bcd.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
onecore\base\telemetry\enterprisedata\src\enterprisedata.cpp(152)\wer.dll!00007FF95C6A1DFA: (caller: 00007FF95C6A1B61) ReturnHr(1) tid(58e4) 80070002 The system cannot find the file specified.
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\netprofm.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\npmproxy.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Security.Authentication.OnlineId.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\OneCoreUAPCommonProxyStub.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\dpapi.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
onecore\base\telemetry\enterprisedata\src\enterprisedata.cpp(152)\wer.dll!00007FF95C6A1DFA: (caller: 00007FF95C6A1B61) ReturnHr(2) tid(444c) 80070002 The system cannot find the file specified.
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
onecore\base\telemetry\enterprisedata\src\enterprisedata.cpp(152)\wer.dll!00007FF95C6A1DFA: (caller: 00007FF95C6A1B61) ReturnHr(3) tid(444c) 80070002 The system cannot find the file specified.
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\OnDemandConnRouteHelper.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\OnDemandConnRouteHelper.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\mswsock.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\IPHLPAPI.DLL'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\winnsi.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\nsi.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\dhcpcsvc6.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\dhcpcsvc.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\webio.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\sspicli.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\dnsapi.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\rasadhlp.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\FWPUCLNT.DLL'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\schannel.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\mskeyprotect.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\ncrypt.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\ntasn1.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\ncryptsslp.dll'. 
'quad.exe' (Win32): Loaded 'C:\Windows\System32\cryptnet.dll'. 
The thread 0x444c has exited with code 0 (0x0).
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
'quad.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. 
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
onecore\windows\feedback\core\werdll\lib\reportstore.cpp(571)\wer.dll!00007FF95C67ABA6: (caller: 00007FF95C68A5A0) LogHr(1) tid(58e4) 80004001 Not implemented
    Msg:[CReportStore::Prune: MaxReportCount=500 MaxSizeInMb=0] [CReportStore::Prune]
onecore\windows\feedback\core\werdll\lib\securityattributes.cpp(452)\wer.dll!00007FF95C69E46B: (caller: 00007FF95C68A6D6) LogHr(2) tid(58e4) 8007109A This operation is only valid in the context of an app container.
    [CSecurityAttributes::GetNewRestrictedFileOrDirectorySecurityAttributes]
The thread 0x51bc has exited with code 0 (0x0).
The thread 0x58e4 has exited with code 0 (0x0).
D3D12 WARNING: ID3D12CommandList::IASetVertexBuffers: Resource 0x00000238EDD1C9B0:'Unnamed ID3D12Resource Object' and 1 other resources contain the GPU Virtual Address range [0x0000000075eae000, 0x0000000075eae05f] on a Heap (0x00000238F87B2A40:'Unnamed ID3D12Heap Object').  This may be OK as long as all of these resources are in the same state however developer probably did not intend to make use of this behavior. [ STATE_CREATION WARNING #926: HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS]
D3D12 WARNING: ID3D12CommandList::IASetVertexBuffers: Resource 0x00000238EDD1C9B0:'Unnamed ID3D12Resource Object' and 1 other resources contain the GPU Virtual Address range [0x0000000075eae000, 0x0000000075eae05f] on a Heap (0x00000238F87B2A40:'Unnamed ID3D12Heap Object').  This may be OK as long as all of these resources are in the same state however developer probably did not intend to make use of this behavior. [ STATE_CREATION WARNING #926: HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS]
'quad.exe' (Win32): Unloaded 'C:\Windows\System32\FWPUCLNT.DLL'

The bit that sticks out to me the most is the [ERROR gfx_backend_dx12::command] Undefined user data element in the root signature at 0. Investigating a bit, the root signature just doesn't have any constants, with indexes 0 & 1 containing Undefined. (2 is TableSrvCbvUav, 3 is TableSampler, 4-63 are all Undefined.) Note that the output does show [INFO gfx_backend_dx12::device] Creating a pipeline layout with 1 sets and 1 root constants, so at some earlier point it is intending to add a root constant.

Testing earlier versions, the hal-0.6 branch is the same; hal-0.5 has the same behavior, but instead of the error message it has this warning, repeated 3 times:

[2020-09-15T20:02:35Z WARN  gfx_backend_dx12::command] Unset or mismatching root constant at index 0 (Undefined)
[2020-09-15T20:02:35Z WARN  gfx_backend_dx12::command] Unset or mismatching root constant at index 1 (Undefined)

Unlike earlier versions, hal-0.4 does not hang, though it still doesn't draw anything. It prints the same warning messages as 0.5, and repeats them whenever I move the mouse. hal-0.3 and hal-0.2 are the same as 0.4, except it warns about root constants at indexes 0-7 instead of just 0 & 1, and repeats the messages constantly, not just when I move the mouse.

Hope this is helpful; let me know if there's anything else it'd be useful for me to do.

@kvark
Copy link
Member

kvark commented Sep 16, 2020

What version of gfx-backend-dx12 was this log obtained from? The "Undefined user data element in the root signature at 0" are supposed to be fixed on latest.

@PeterHatch
Copy link

What version of gfx-backend-dx12 was this log obtained from? The "Undefined user data element in the root signature at 0" are supposed to be fixed on latest.

It's the latest version - most recent commit is 4871e2d305210ea79aea392c600361bbafa25a23. Or possibly one version earlier, I updated at some point while working on things, but the last commit just changed the metal backend, and testing on the latest again still shows the same error.

@kvark
Copy link
Member

kvark commented Sep 16, 2020

Ok, this may be a red herring. The problem was that the example declared the push constants but didn't bind them (with bind_graphics_constants. I removed the use of push constants from the quad example in the latest commit, so it should run without these warnings now. Also, I filed #3374 to figure out how D3D12 should handle default values in push constants, which affects the colour-uniform example, but is always easy to work around for the users.

@PeterHatch
Copy link

Yeah, that fixes the error message but nothing else.

My next guess at the issue is this output from Visual Studio:

D3D12: Removing Device.
D3D12 ERROR: ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_DEVICE_HUNG: The Device took an unreasonable amount of time to execute its commands, or the hardware crashed/hung. As a result, the TDR (Timeout Detection and Recovery) mechanism has been triggered. The current Device Context was executing commands when the hang occurred. The application may want to respawn and fallback to less aggressive use of the display hardware). [ EXECUTION ERROR #232: DEVICE_REMOVAL_PROCESS_AT_FAULT]

It's triggered by trying to present the first frame, with this code:

            // present frame
            let result = self.queue_group.queues[0].present(
                &mut self.surface,
                surface_image,
                Some(&self.submission_complete_semaphores[frame_idx]),
            );

But not sure how to track it down any further, since it's presumably something about how the scene was set up earlier that is causing the issue.

@kvark
Copy link
Member

kvark commented Sep 16, 2020

Yeah, that's unfortunate, and matches other reports. It appears that, either:

  • the driver has a bug that hangs it even though the runtime sees nothing wrong
  • or the D3D12 runtime is missing some checks that we are doing wrong

Next possible step is - trying to reduce the work we do, and seeing when it starts working again. For example, the first comment here talks about the tutorial. What about wgpu's hello-triangle example?

@PeterHatch
Copy link

Okay, I think I figured out the problem. Part of it, at least. The issue seems to be when running on cards that only support Resource Tier 1 - there's significant code for that case, and I'm not sure it's ever been tested; it's certainly not working now.

In particular, allocate_memory has code to calculate mem_group from the input mem_type, and it needs to be non-0 for Resource Tier 1 cards - currently there's nothing to actually cause that input to change in the needed manner for those cards. So we create memory using a set of flags that's not allowed for Resource Tier 1 cards, and unfortunately that apparently doesn't give us a warning, it just means the card hangs later.

@kvark
Copy link
Member

kvark commented Sep 17, 2020

That's a wonderful investigation!
Looking at our DX12 code, I can't confirm your findings.

The Resource Tier 1 is checked as heterogeneous_resource_heaps in here.
Then it's used to build a list of memory types, where we have N types per each of the resource kind, just like the tier-1 requires.

Getting memory requirements from resources returns a mask corresponding to the resource type only, see here.

Finally, when allocating memory, we select the the mem_group based on the memory type id. In case of tier-1, this should always be 1, 2, or 3, since that's what the corresponding memory requirements dictated.

So, in theory, all the code is there. I did however found a case where the code would be wrong: if TRANSFER_DST is requested for an image without COLOR_ATTACHMENT, and the image format is not renderable. The code that selected the memory types would consider this to be in the render-target heap. But the code creating the resource would consider it to be non-renderable. This is something that could easily happen during error fixing on DX12 on fresh hardware.... I filed gfx-rs/gfx#3376 to fix this.

However, I'm not seeing how we'd hit this case. The quad example in gfx-rs only uses a single data format for the texture - Rgba8Srgb, which is renderable on all hardware. So it might be that we are still missing the actual problem. I'm hoping the PR will help you investigate this further. Please find that root cause!

@PeterHatch
Copy link

PeterHatch commented Sep 18, 2020

Ah, yes, I was wrong. I was conflating Resource Heap Tier & Resource Binding Tier. (I knew I was confused about whether or not the two functions were done by the same thing, but read something that made me think they were; looking back, I seem to have just misread it.) My card is Resource Heap Tier 2, which is why the debugger was showing mem_group as 0 when I looked; because it was supposed to. And then I missed how that was set when looking at the code.

Resource Binding Tier is separate, and it's 1 on the same cards we've seen failure reports on. (And 2 only on Nvidia's Kepler chipset, according to the chart at https://en.wikipedia.org/wiki/Feature_levels_in_Direct3D.) This is never actually checked - if it is the issue, I think it would not be from the resource limits but the one other restriction (from https://docs.microsoft.com/en-us/windows/win32/direct3d12/hardware-support):

There is an additional restriction for Tier 1 hardware that applies to all heaps, and to Tier 2 hardware that applies to CBV and UAV heaps, that all descriptor heap entries covered by descriptor tables in the root signature must be populated with descriptors by the time the shader executes, even if the shader (perhaps due to branching) does not need the descriptor. There is no such restriction for Tier 3 hardware. One mitigation for this restriction is the diligent use of Null descriptors.

I don't know enough to know if that's something that's being done or not.

@kvark
Copy link
Member

kvark commented Sep 18, 2020

The binding tier seems to only have lower maximum counts for resource bindings. The quad example doesn't nearly put a pressure on those. And it also binds all the descriptor heaps that are referenced from the descriptor tables. So there is no UB there.
I may be wrong, but I think when we were writing the D3D12 backend originally, we assumed Resource Binding Tier 1. That is reflected in the limits we expose, so there are no additional checks. If it's not true, then we definitely need to check for it.

@PeterHatch
Copy link

So this seems to be a driver issue, for me at least. Using the driver Windows Update considers the latest available - from 2015! - it works. Intel Driver & Support Assistant finds a 2020 driver, but will not install it, saying to check the computer manufacturer's site instead - HP in my case, and they don't have a Windows 10 graphics driver for this computer. Intel has instructions on how to manually install the driver, with the note that it could cause issues - that's what I'd done, and apparently it did indeed cause issues.

@cwfitzgerald
Copy link
Member

Intel drivers had OEM locks on them until very recently, which is preventing you from upgrading. Is this the instructions you followed https://www.intel.com/content/www/us/en/support/articles/000056629/graphics.html?

@cwfitzgerald
Copy link
Member

Closing due to backend rewrite.

@teoxoy teoxoy added external: driver-bug A driver is causing the bug, though we may still want to work around it api: dx12 Issues with DX12 or DXGI and removed type: bug Something isn't working labels Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: dx12 Issues with DX12 or DXGI external: driver-bug A driver is causing the bug, though we may still want to work around it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants