vkd3d-proton icon indicating copy to clipboard operation
vkd3d-proton copied to clipboard

Unable to replay apitrace from native D3D12

Open Saancreed opened this issue 2 years ago • 4 comments

I'm unable to replay apitrace I've recorded using my Windows VM on vkd3d-proton due to an error:

Unhandled exception: page fault on read access to 0x00000000000003e0 in 64-bit code (0x0000035e50c5eb).
Register dump:
 rip:000000035e50c5eb rsp:000000000011f670 rbp:000000000011f6f0 eflags:00010206 (  R- --  I   - -P- )
 rax:0000000000000000 rbx:00000000002fb250 rcx:000000000011f6a0 rdx:0000000000000000
 rsi:000000000032c140 rdi:00000000002fb488  r8:ffffffffffffffff  r9:00000000002fb488 r10:0000000000230148
 r11:00000000002fb488 r12:0000000140000000 r13:000000000024a850 r14:000000000bbf0030 r15:0000000000000000
Stack dump:
0x0000000011f670:  000000000011f6a0 0000000000000000
0x0000000011f680:  0000000000000000 000000018007fc97
0x0000000011f690:  0000000000000000 000000000011f7c0
0x0000000011f6a0:  0000000000000000 0000000000000440
0x0000000011f6b0:  0000000000000448 0000000000000000
0x0000000011f6c0:  000000000011fa31 00000001800e41c0
0x0000000011f6d0:  0000000000000031 0000000000000031
0x0000000011f6e0:  00000001800e41f0 000000018007fb40
0x0000000011f6f0:  00000001800e4131 00000001800e41c0
0x0000000011f700:  0000000000000031 0000000000000031
0x0000000011f710:  000000000011f7a9 000000018006da84
0x0000000011f720:  00000001800e41c0 00000001800e41c0
Backtrace:
=>0 0x0000035e50c5eb d3d12_descriptor_heap_write_null_descriptor_template+0x35(desc_va=0, vk_mutable_descriptor_type=VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) [Z:\build\vkd3d-proton\src\vkd3d-proton\libs\vkd3d\resource.c:3824] in d3d12 (0x0000000011f6f0)
  1 0x0000035e50d7b4 vkd3d_create_texture_srv+0x68(desc_va=0, device=000000000BBF0030, resource=0000000000000000, desc=00000000002FB488) [Z:\build\vkd3d-proton\src\vkd3d-proton\libs\vkd3d\resource.c:4252] in d3d12 (0x0000000011f980)
  2 0x0000035e50de59 d3d12_desc_create_srv+0xd3(desc_va=0, device=000000000BBF0030, resource=0000000000000000, desc=00000000002FB488) [Z:\build\vkd3d-proton\src\vkd3d-proton\libs\vkd3d\resource.c:4401] in d3d12 (0x0000000011faa0)
  3 0x0000035e4f1c58 d3d12_device_CreateShaderResourceView+0x9e(iface=000000000BBF0030, resource=0000000000000000, desc=00000000002FB488, descriptor={ptr=0}) [Z:\build\vkd3d-proton\src\vkd3d-proton\libs\vkd3d\device.c:4005] in d3d12 (0x0000000011fb00)
  4 0x0000014004ae5c in d3dretrace (+0x4ae5c) (0000000000000000)
  5 0x0000014008e74e in d3dretrace (+0x8e74e) (0x0000000011fc70)
  6 0x0000014008e96d in d3dretrace (+0x8e96d) (0x0000000011fc70)
  7 0x0000014008e08d in d3dretrace (+0x8e08d) (0x0000000011fc70)
  8 0x0000014008fe49 in d3dretrace (+0x8fe49) (0x0000000011fd80)
  9 0x000001400fbd50 in d3dretrace (+0xfbd50) (0000000000000000)
  10 0x0000007b627f69 in kernel32 (+0x27f69) (0000000000000000)
  11 0x0000017005cc06 in ntdll (+0x5cc06) (0000000000000000)
0x0000035e50c5eb d3d12_descriptor_heap_write_null_descriptor_template+0x35 [Z:\build\vkd3d-proton\src\vkd3d-proton\libs\vkd3d\resource.c:3824] in d3d12: movzbl	0x000000000003e0(%rax),%eax

Unless Wine and/or debug symbols are deceiving me, this would point to this line:

https://github.com/HansKristian-Work/vkd3d-proton/blob/fd05839eb964d0edc0accce6db81d076ad3d33b1/libs/vkd3d/resource.c#L3824

I don't think this is a bug with apitrace because the same trace replays fine in the VM used to record it.

  • apitrace build from here
  • vkd3d-proton version 2.6.r144.gfd05839e, built from commit fd05839eb964d0edc0accce6db81d076ad3d33b1
  • NVIDIA GTX 1660 Ti Mobile, driver version 516.01 for recording and 515.48.07 for replaying

Side note, but this apitrace is an attempt to repro AC Valhalla hanging on NV 515, if all goes well it should also hang on replay before I abruptly killed the game to make the trace a bit smaller.

Saancreed avatar Jun 05 '22 22:06 Saancreed

I don't see how this is a vkd3d-proton bug. desc_va is 0 here, so this is obviously going to crash. Seems more like an apitrace issue?

HansKristian-Work avatar Jun 06 '22 11:06 HansKristian-Work

Fair enough, but it still doesn't crash when replaying on native D3D12. Could d3dretrace's behavior be different between native D3D12 on Windows an vkd3d-proton in Wine or does native D3D12 just somehow handle such garbage input?

Saancreed avatar Jun 06 '22 11:06 Saancreed

Full API trace logs would be good. Its likely a resource failed to be mapped or created which re return a null VA for

Joshua-Ashton avatar Jun 06 '22 11:06 Joshua-Ashton

@Joshua-Ashton d3dretrace.log.gz

Made it extra verbose too, I hope it's not too noisy. Let me know if you need anything else.

Saancreed avatar Jun 06 '22 16:06 Saancreed