Dxvk: D3D11DeviceContext missing ID3D11Multithread

Created on 15 Apr 2018  路  42Comments  路  Source: doitsujin/dxvk

Some games depend on this being available, might be a feature of higher d3d11 level than supported atm so maybe not applicable now to dxvk, not sure, although it seems to be the same interface as ID3D10Multithread.

warn:  D3D11DeviceContext::QueryInterface: Unknown interface query
warn:  9b7e4e00-342c-4106-a19f-4f2704f689f0

Software information

Several games are likely blocked by this (spotted in Nioh just before it crashing)

Not attaching full log files or apitraces since I don't think it's of much use on this.

Defined in wine at:

d3d10 d3d11

Most helpful comment

So I did some testing and to my surprise, ID3D11Multithread can already be queried from the device context on Windows 8.1, despite being undocumented for that OS.

I pushed an experimental d3d10-multithread branch which implements the interface in a way that should hopefully make Nioh happy. This will have a performance impact.

All 42 comments

That's part of D3D11.4, which I do not and will not support. Most games should work without it unless they explicitly require Windows 10.

ok sorry about that will look better at the d3d11 versions next time

I'm curious, what are the reasons that speak against implementing this? Of the big titles I only know Nioh that requires it, but if they use the same engine maybe Nioh 2 will be the same, and other Koei Tecmo games?

I think I'll have to implement this anyway for D3D10. ID3D10Multithread and ID3D11Multithread seem to be identical and may even share the same GUID, which I wasn't aware of until recently.

Then again, I'm not sure how exactly it is supposed to work. The documentation is garbage (as usual) and doesn't define whether the interface is just a glorified mutex that the application has to use manually in all cases, or whether it is used internally in the implementation as well in some situations (e.g. on Present()).

Disgaea 5 is missing this in D3D11DeviceContainer:

0163:fixme:vulkan:wine_vk_device_convert_create_info Application requested a linked structure of type 0x3b9db032.
info:  DXVK: Read 0 valid state cache entries
info:  DXVK: Using 2 compiler threads
warn:  D3D11DeviceContainer::QueryInterface: Unknown interface query
warn:  9b7e4e00-342c-4106-a19f-4f2704f689f0
wine: Unhandled page fault on read access to 0x00000000 at address 0x1408917d6 (thread 0163), starting debugger...

Can you record an apitrace? It would be weird for a D3D11 game to require this without having a fallback, because that would mean it requires Windows 10.

The code quality of the game seems to be quiet garbage, which also caused a lot of crashes on Windows, so I'd not be surprised that if they get past some point in the code they assume you have Windows 10 or something and don't do further error checks. I also noticed when fixing some crashes in Wine with mfplat that they always use get methods in an infinite while loop instead of callbacks...

One of the things that happens with Wine without DXVK is that it seems to get stuck in some infinite d3d11 related while loop, and the apitrace grows to gigabytes within seconds. Should I post the first few (10k?) lines of the dump maybe?

Do you have a Windows system to work with? A wined3d apitrace won't help if it bugs out.

I don't have a Windows system, sorry. I attached the first 200 lines of the log with Wine. All lines after that are the same. The crash with DXVK happens after line 130.

disgaea-trace.txt

This is the first and last game I want to get working lol Is there anyway I can help with this.
You said back in April "I think I'll have to implement this anyway for D3D10" did this ever happen?
Apologies for my ignorance. I'm new and just trying to learn.

I did have an incorrect implementation at some point, but removed it because it was incorrect and no game that I could test wanted it anyway.

The main issue here is that the interaction with ID3D10Multithread and D3D11 is undocumented, and that even for D3D10 it is not entirely clear what this interface is supposed to do. I will have to do a lot of testing before implementing it in order to figure out what it's supposed to do.

If you have a Windows OS installed, it would be helpful if you could record an apitrace as described here.

Should a new issue be created by the way, or is it fine to have everything in this closed issue?

Il fire up my windows vm and get testing aswell

nioh.trace.zip

This one is only 9kb....^^
I ran another one and its 500mb... compressed 300mb. Which one is correct?
Im uploading the bigger one to mediafire regardless.

let me know if this is any help

@doitsujin Let me know when you get a chance to look at this. :) stay safe.

I'm looking at this but I'm not sure what to do about it. The D3D11 interaction with this interface is undocumented, and if I understand correctly, it actually wants me to lock the D3D11 immediate context on every single call, which has a significant performance cost even if it's not needed.

Also, according to MSDN, it is not supported before Windows 10. Does the game not work on Windows 8.1 or 7?

edit......

no it does support support 7 - 8.1 - 10

just checked the steam page. Only on a 64bit system though

im not sure if any anti cheat or drm is running in the background for this. Maybe its affecting it.

Anticheat doesn't execute D3D11 calls.

So I did some testing and to my surprise, ID3D11Multithread can already be queried from the device context on Windows 8.1, despite being undocumented for that OS.

I pushed an experimental d3d10-multithread branch which implements the interface in a way that should hopefully make Nioh happy. This will have a performance impact.

OMG!!!!!!!!!!!!!!!!!!!!!!!!!!!! you sir..... are a fucking savage !!!!! performance hit means nothing to me lol I have a machine that can run 4k 60fps but im happy to play at 1080p :::))))

Does that mean it works?

im pretty confident it will work from his response. Lets be patient. I bought the game in february. Im sure i can wait a little longer. The work on this project is amazing. I just downloaded "spacelords" and clicked play. 1 year ago would of been impossible.

@jdontplay if you can't build DXVK yourself, can you please test this build with Nioh:
dxvk-multithread.tar.gz

I'd like to have some confirmation that the game works before merging it.

Tried the launcher to change Nioh settings, but the launcher never actually starts (there is a process taking CPU time, but no window appears).

Launching Nioh without settings leads to a crash, I attach two backtraces, one with Windows version set to 7, one to 10. apitrace with Windows set to 7.

On the console with WINEDEBUG=+tid,+d3d11,+d3d,+d3d10 I see:

info:  D3D11CoreCreateDevice: Probing D3D_FEATURE_LEVEL_11_0
info:  D3D11CoreCreateDevice: Using feature level D3D_FEATURE_LEVEL_11_0
info:  Enabled device extensions:
info:    VK_EXT_shader_viewport_index_layer
info:    VK_EXT_transform_feedback
info:    VK_EXT_vertex_attribute_divisor
info:    VK_KHR_dedicated_allocation
info:    VK_KHR_descriptor_update_template
info:    VK_KHR_get_memory_requirements2
info:    VK_KHR_image_format_list
info:    VK_KHR_maintenance1
info:    VK_KHR_maintenance2
info:    VK_KHR_sampler_mirror_clamp_to_edge
info:    VK_KHR_shader_draw_parameters
info:    VK_KHR_swapchain
00ae:fixme:vulkan:wine_vk_device_convert_create_info Application requested a linked structure of type 0x3b9db032.
00ae:fixme:vulkan:wine_vk_device_convert_create_info Application requested a linked structure of type 0x3b9b3760.
info:  DXVK: Read 0 valid state cache entries
info:  DXVK: Using 2 compiler threads
wine: Unhandled page fault on write access to 0x00000000 at address 0x140f5d0c0 (thread 00ae), starting debugger...

I verified that DXVK normally works on this setup in a different WINE prefix with DXVK 0.93 and Witcher 3 from GOG. That works fine.

System: Debian buster, Nvidia driver 396.54.09 from Nvidia's website, WINE 3.21, kernel 4.18.

The game crashes inside its own code now, for reasons that are probably unrelated to D3D11 since the original apitrace replays just fine. Can you test if it works on an actual Windows machine with DXVK?

sorry. I am at work right now But will test regardless when i get in.

@psy-q nevermind my previous comment, there was a bug that would return the wrong interface back to the game. I updated the branch to fix it, if you need a build, here's one:
dxvk-multithread.tar.gz

cf21111 Seems to be causing a slight performance regression for nVidia tho, but then again, the 415.18.02 driver also saw a small setback for me.

Not really sure what this patch even do when it comes to multithreading, as I easily get confused with compilerTHREADS, multiTHREAD and THREADED_optimizations :)

Ah well.. most things still playable :)

It's true that implementing this interface is not free, even for games that don't need it, but the performance impact should be negligible (should be a single-digit number of CPU cycles per D3D11DeviceContext method call).

Yeah.. seems <1% so its no biggie. I'm sure you figure out someday a tweak that optimizes this :)

Reverting this and a couple of others i have found over a bit of time, i can earn 2-3%... but that aswell as any degradation less than "extreme" is kinda hard to revert, cos what steals from one game, can benefit another :)

I'm sure you figure out someday a tweak that optimizes this :)

No. It is already tweaked and optimized and I'm pretty sure there is no room for further optimization for this particular feature. It literally adds four instructions per function on the fast path. You just can't expect everything to get magically faster.

It starts and displays its window! I waited a minute or two with a black window, I know on Windows it takes quite a while to do anything useful as well. So far nothing more happened. The Nioh process is eating 1.9 GB of RAM and strace shows it reading and writing constantly (couldn't catch the descriptors though) and taking 190% CPU on a 4-core machine.

I will let it run for 10 minutes or so. Here's an apitrace of the first minute.

Edit: It's playing the music from its title screen normally, just with a black window. Input appears to be ignored, I can't hear the audio cues that I would expect when e.g. moving around in the main menu.

Doesn't look or sound like a DXVK bug at all. It replays your apitrace just fine, it's just that the game doesn't even try to render anything useful - there's something going wrong elsewhere.

Anyway, closing because the original issue is resolved.

No. It is already tweaked and optimized and I'm pretty sure there is no room for further optimization for this particular feature.

"Pretty sure" = "could be" Yay! :+1:

Please stop having unreasonable expectations.

Truth be told, since i am truly a pessimistic person, i more or less expect every new patch submission to break everything when it comes to dxvk+nVidia...

Well.. you could not leave it alone with a positive comment from me could you? :)

I have installed 0.95 dxvk. The game runs with sound but not visuals. I can play and everything but no visuals. WE ARE GETTING THERE!!!

@jdontplay i was able to play this game today (finally!) all i have to do is add launch option DXVK_CONFIG_FILE="/home/username/nioh.conf" %command% and launch the game with Proton 4.2. All works except for movies. Here is my config file. Just put it into your home directory and run the game. Hope it helps you!
Nioh.conf

@arzardk Absolute Legend. I have recently got "outward" amazing game. Once im done with that il jump on Nioh. Thanks so much everyonoe. Proves that patients is a virtue

I'm not sure if this is the proper place to comment or if a new ticket should be created, but I have also finally been able to get Nioh running using Proton 4.2-1.

One issue remains, however. It seems that landing a critical hit (head-shot) with a ranged weapon crashes the game. I'm not sure how to debug Proton games, so if someone would be willing to show me an example, I would be happy to supply a trace of this happening.

Was this page helpful?
0 / 5 - 0 ratings