obs-studio/plugins/win-capture/graphics-hook
jp9000 c4036b18bb win-capture/graphics-hook: Fix D3D10/D3D11 detection
When hooking DXGI-based graphics programs in the hook, the first hook
point is IDXGISwapChain::Present.  To be able to initiate a capture, a
pointer to the device context that created the swap chain is required,
which can be retrieved via IDXGISwapChain::GetDevice.  Determining
whether the device context was D3D10 or D3D11 has always been somewhat
of an issue due to D3D10 and D3D11 being nearly identical, as well as
their interoperability/interchangeability.  The GetDevice function would
first be called with the UUID of ID3D10Device, then if that failed,
the UUID of ID3D11Device.

However, with certain specific D3D11 games, GetDevice would for some
unknown reason succeed with the UUID of ID3D10Device, which would cause
capture to fail.  (Conversely, attempting to call GetDevice with the
UUID of ID3D11Device on a device that's actually ID3D10Device would
always succeed, so reversing the order of the test was not an option).
There were originally three known D3D11 games that would erroneously
succeed when querying a D3D10 device interface:  Call of Duty: Ghosts,
Just Cause 3, and theHunter: Call of the Wild.  All other known D3D11
games would work correctly.  Because it was only these three games, a
hack was originally implemented in the form of an executable exception
list that would force them to capture D3D11.

Unfortunately, Oculus games are now failing under the same circumstance
as well, so a simple hack will no longer work.  To fix this, a more
reliable method of detecting which context it is had to be discovered:
simply check the feature level using ID3D11Device::GetFeatureLevel.  If
the feature level is D3D_FEATURE_LEVEL_11_0 or D3D_FEATURE_LEVEL_11_1,
the device is definitely a D3D11 device.  Otherwise, continue the tests
as they were before.  Successfully tested with many D3D10 games, many
D3D11 games, and especially those three D3D11 games that previously were
detected as D3D10 erroneously.
2017-06-15 03:48:43 -07:00
..
CMakeLists.txt win-capture: Use static runtimes for hooks/helpers 2016-11-23 06:03:00 -08:00
d3d1x_shaders.hpp win-capture: Add graphics-hook library 2014-12-09 14:21:07 -08:00
d3d8-capture.cpp Fix various typos across multiple modules 2017-04-25 22:39:42 -04:00
d3d9-capture.cpp Various: Don't use boolean bitfields 2017-05-10 23:28:46 +02:00
d3d9-patches.hpp win-capture: Update D3D9 patches 2016-08-06 15:27:33 -07:00
d3d10-capture.cpp Various: Don't use boolean bitfields 2017-05-10 23:28:46 +02:00
d3d11-capture.cpp Various: Don't use boolean bitfields 2017-05-10 23:28:46 +02:00
d3d12-capture.cpp Various: Don't use boolean bitfields 2017-05-10 23:28:46 +02:00
dxgi-capture.cpp win-capture/graphics-hook: Fix D3D10/D3D11 detection 2017-06-15 03:48:43 -07:00
dxgi-helpers.hpp win-capture: Fix enum switch warnings 2015-02-09 03:49:46 -08:00
gl-capture.c Various: Don't use boolean bitfields 2017-05-10 23:28:46 +02:00
gl-decs.h win-capture: Add game capture fix for darkest dungeon 2016-01-26 11:49:28 -08:00
graphics-hook-config.h.in win-capture: Add D3D12 capture support 2016-11-03 12:13:42 -07:00
graphics-hook.c graphics-hook: Account for sizeof(wchar_t) in len 2017-02-25 17:18:55 +01:00
graphics-hook.h win-capture: Don't use FindWindow for game capture keepalive 2017-01-15 09:15:45 -08:00