mumble icon indicating copy to clipboard operation
mumble copied to clipboard

D3D11: CreateDeferredContext error

Open AllianceDarkSylinc opened this issue 9 years ago • 1 comments

Hi!

It appears Mumble hooks to D3D11 applications, and eventually calls CreateDeferredContext.

However, if the context was created with the flag D3D11_CREATE_DEVICE_SINGLETHREADED; this function is forbidden. For some reason the debug layer complains about it in 64-bit mode, but not in 32-bit mode.

Mumble should detect this flag when hooking and unset it.

AllianceDarkSylinc avatar Jun 28 '15 23:06 AllianceDarkSylinc

Thanks for the info! Marked as up-for-grabs.

mkrautz avatar Jun 29 '15 12:06 mkrautz

Was this addressed or is it still an issue?

ghost avatar Feb 14 '23 01:02 ghost

It's been years since I stopped using Mumble.

I can give it a try though. I just need to launch one of our d3d11 samples while Mumble is open.

AllianceDarkSylinc avatar Feb 14 '23 14:02 AllianceDarkSylinc

OK I installed the latest version.

It seems Mumble has changed since the last time I submitted this ticket:

  1. Back in 2015, Mumble would try to hook ONTO EVERYTHING. Causing problems like this.
  2. It seems now Mumble is much more conservative on what it hooks onto, it has white & blacklists; and by default it seems like my apps are not being hooked
  3. If I force Mumble to hook to my app (by adding it on the "whitelisted programs") the problem occurs

So here's the thing:

  1. This problem no longer bothers me (even I were to use Mumble)
  2. However Mumble seems to be forcing undefined / forbidden / broken behavior on some of the D3D11 games it can hook on.
    • Ideally Mumble should hook onto D3D11CreateDevice and unset D3D11_CREATE_DEVICE_SINGLETHREADED
    • Release apps won't complain, but that just means the bug remains hidden.

The D3D11 validation layer error msg is:

ID3D11Device::CreateDeferredContext: Creation of a Device with D3D11_CREATE_DEVICE_SINGLETHREADED prevents the creation of deferred contexts.
ID3D11Device::CreateDeferredContext: CreateDeferredContext returning DXGI_ERROR_INVALID_CALL, meaning the function can not be used.

(Note that it is Mumble who calls CreateDeferredContext)

Btw I tried v 1.4.287, not the dev version

AllianceDarkSylinc avatar Feb 14 '23 23:02 AllianceDarkSylinc

If you wish I can upload an app you can test against that will complain very loudly until you fix it?

AllianceDarkSylinc avatar Feb 14 '23 23:02 AllianceDarkSylinc

This may contain some of the offending files:

https://github.com/mumble-voip/mumble/tree/master/overlay

If there is something you see that could be wrong, feel free to point it out. We have someone else that does D3D stuff but may be busy. Welcome back to Mumble?

Edit: I think I found the culprit: https://github.com/mumble-voip/mumble/blob/dfe9dba996f68ca43a1f16d849be8df9f1594558/overlay/d3d11.cpp#L285

ghost avatar Feb 14 '23 23:02 ghost

Oh I see!

Since you handle the failure correctly, then there is nothing wrong.

The validation layer just complains about this error, but you are handling it. Our app in Debug mode is set to stop on any error.

Therefore this ticket can be closed, now that Mumble doesn't indiscriminately hook onto everything like before.

The "error" could be fully silenced by detecting the SINGLETHREADED flag instead of attempting to create the deferred context, but IMHO the amount of complexity to implement such feature is not worth it, given that one can just blacklist the process in the worst case.

I'm closing this ticket. For all intents and purposes, it's fixed. If someone in the future somehow has a related problem, they can open a new ticket.

And if that happens the quickest hack would be an UI checkbox that means "this particular process, don't attempt to create deferred contexts, just assume it's single threaded"

AllianceDarkSylinc avatar Feb 15 '23 00:02 AllianceDarkSylinc