Commit graph

271 commits

Author SHA1 Message Date
Ryan Foster e5d5df879c libobs: Add function to check fast clear capability 2023-07-29 16:34:47 -07:00
Ryan Foster a8f770fdfc libobs-d3d11: Check if device can perform fast clear on init
NVIDIA GPUs in multi-GPU setups cannot safely perform a fast clear until
driver 527.37. Implement a check against the Vendor ID and driver
version of the adapter to determine if the adapter can safely perform a
fast clear.

Co-authored-by: derrod <dennis@obsproject.com>
2023-07-29 16:34:47 -07:00
derrod 2e4d1f3f54 libobs-d3d11: Create shader cache directory when creating device 2023-07-22 18:04:08 -07:00
Richard Stanway e7a3ffdb54 libobs-d3d11: Implement shader cache
Co-Authored-By: derrod <dennis@obsproject.com>
2023-07-22 16:59:31 -07:00
Ryan Foster 9967322834 libobs-d3d11: Left-pad device PCI ID to 4 characters with zeroes 2023-07-15 16:41:45 -07:00
derrod dcc07cfe4e clang-format: Set AllowAllConstructorInitializersOnNextLine to false 2023-07-15 16:14:55 -07:00
PatTheMav db895092ed cmake: Add changes for CMake build framework 3.0
New code path only taken if OBS_CMAKE_VERSION is set to 3.0.0 or
greater, old functionality remains unchanged.
2023-06-29 10:11:32 -04:00
Rodney 6efe7ab1c8
libobs-d3d11: Log HAGS driver support and status 2023-06-17 16:04:48 -07:00
derrod 9de6b18d5c libobs-d3d11: Set priority to high instead of realtime if HAGS enabled 2023-05-20 16:24:58 -07:00
derrod 283d59f068 libobs-d3d11: Refactor set_priority to use included header 2023-05-20 16:24:58 -07:00
derrod 0a477ba3ba libobs-d3d11: Log HAGS status 2023-05-20 16:24:58 -07:00
Lain 106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
PatTheMav 349372b3b3 cmake: Add changes for CMake build framework 3.0
New code path only taken if OBS_CMAKE_VERSION is set to 3.0.0 or
greater, old functionality remains unchanged.
2023-03-26 18:20:38 -04:00
Jim e9ef38e3d3
Merge pull request #7978 from jpark37/dxgi-display-sdr-on-hdr
libobs-d3d11,win-capture: Add Force SDR for DXGI duplicator
2023-03-20 01:43:14 -07:00
Ryan Foster dc5813c947 libobs-d3d11: Log D3D11 adapter memory correctly
DXGI_ADAPTER_DESC's DedicatedVideoMemory and SharedSystemMemory are
unsigned long long int, but we were logging them as unsigned int. For
GPUs with memory values higher than 4294967295, the logged value would
roll over. Use %PRIu64 (%llu on VS2022) instead of %u in the log call.
2023-02-25 15:42:01 -08:00
jpark37 7bfde66578 libobs-d3d11: Support color spaces for duplicator
Need this plumbing to make decisions about duplicator colors.
2023-02-19 11:40:32 -08:00
Richard Stanway 150124038b libobs-d3d11: Convert monitor name to UTF-8 for logging 2023-02-15 15:36:13 -05:00
jpark37 35ee1b2ed1 libobs-d3d11: Log display ids 2023-02-11 15:05:28 -08:00
derrod 4fe2a43f00 libobs-d3d11: Log display DPI 2023-02-04 15:33:35 -08:00
jpark37 2e7f7acfeb libobs-d3d11: Log monitor color depth 2023-01-24 19:39:42 -08:00
tytan652 107b2a8f27 libobs-d3d11,libobs-opengl,plugins: Remove unneeded cast in switches
Those casts were usually used to workaround switch warnings.
2023-01-16 11:52:26 +01:00
Ryan Foster 88ea0bbb56 Revert "libobs-d3d11: Default to Intel IGPU on IGPU+DGPU systems"
This reverts commit c83eaaa51c.
2022-12-30 21:14:15 -08:00
Ryan Foster 19abcbcd3c Revert "libobs-d3d11: Make sure libobs knows the new adapter index"
This reverts commit e62759a3fa.
2022-12-30 21:14:15 -08:00
Jim e62759a3fa libobs-d3d11: Make sure libobs knows the new adapter index
Because Intel has wonderful code which forces it to run on the iGPU if
there are both an Intel iGPU and an Intel dGPU on the same system, the
adapter index OBS is set to internally will no longer be valid, thus if
anyone calls `obs_get_video_info()` to try to find out what adapter
index OBS is running on, it will be invalid on those computers.
Wonderful.

So, basically, this code here just fixe it so if you want to call
`obs_get_video_info()`, it'll actually have a valid adapter index now,
that way we can reference the adapter index when determining what GPU
we're actually running on without having to like, do anything super
complicated and silly like comparing adapter GUIDs just to figure out
what adapter OBS is actually runing on. I don't want the code to be a
mess anymore.

(I like how in any other situation on the face of the planet, there's no
need to force OBS to run on an integrated adapter. *Normally* OBS
*should* run on the dedicated adapter, that way it can actually capture
games properly. You can probably guess as to why they're forcing it to
run on the integrated adapter rather than the dedicated adapter. But you
know what? Whatever. I don't really care anymore I guess. Just...
whatever. Here we are I guess. Also I was in a bad mood while writing
this just as a disclaimer.)

(I hate that this commit exist. I hate that the commit c83eaaa51c exists
even more.)
2022-11-21 08:47:36 -08:00
PatTheMav 49ad848514
libobs-d3d11: Replace invocations of sprintf with snprintf
Fixes deprecation warnings in Xcode 14/clang on macOS and reduces
chance of buffer overflows.
2022-11-11 19:51:27 +01:00
jpark37 d9fe6977a6 libobs-d3d11: Support advanced SDR window preview
Displays more than 8 bpc if monitor is configured to be higher.
2022-11-09 22:35:24 -08:00
jpark37 2d0e312b30 libobs-d3d11: Unbind framebuffer before Present
D3D debug layer would INFO spam about RTV0 unbind for FLIP chains.
2022-08-17 23:20:13 -07:00
jpark37 b4f7499b33 libobs-d3d11: Force SDR for legacy swap chain
Legacy DISCARD does not support HDR, so prevent HDR preview.
2022-08-10 03:44:34 -07:00
jpark37 4fe6803fe4 libobs: Prevent D3D11 projectors from tearing
Some users stream projectors, so don't let them tear. Use the waitable
object to check the flip queue, and only flip if there's space.

Metal and Vulkan can probably perform similar flip throttling once OBS
starts using them.
2022-08-06 16:16:20 -07:00
jpark37 d9d4b69a59 libobs-d3d11: Add monitor to HDR status cache
Requesting HDR status is surprisingly expensive.
2022-04-14 09:36:09 -07:00
jpark37 eccde48926 libobs/graphics: Add gs_is_monitor_hdr
Only Windows is implemented for now. Mac/Linux return false for now.
2022-03-23 22:35:26 -07:00
jpark37 abddfead2f libobs/graphics: Add color space support 2022-03-23 22:35:26 -07:00
jpark37 fee3703f40 libobs/graphics, libobs-d3d11: Add P010 support 2022-03-20 17:22:13 -07:00
jpark37 484881fe2e libobs-d3d11: Remove Intel NV12 whitelist
List is not necessary now that NV12 is only used for GPU encoders.
2022-03-19 15:39:09 -07:00
jpark37 1c4148408f libobs-d3d11: Make gs_clear honor FRAMEBUFFER_SRGB
This matches the behavior of glClearColor/glClear on OpenGL.
2022-03-19 15:37:26 -07:00
PatTheMav 1fd7770548
libobs: Update CMakeLists.txt for libobs and associated libraries
Also updates libobs-opengl, libobs-d3d11, libobs-winrt
2022-03-16 23:11:08 +01:00
jpark37 b7ab8cf838 libobs-d3d11: Simplify duplicator formats
Remove DXGI_FORMAT_R10G10B10A2_UNORM since it can be ambiguous whether
it is Rec. 2020 PQ, or high-precision sRGB. We can revisit later.
2022-03-09 23:05:45 -08:00
jpark37 ed70de55cf libobs-d3d11: Relax minimum Windows for flip model
We'll need flip model swap chains in the future for HDR, and we don't
want to limit HDR to WIndows 11. The new test is the existence of
IDXGIFactory5, which was introduced in Windows 10 1607. This should be
enough for HDR, for which we use APIs in Windows 10 1703.

Hopefully having SetMaximumFrameLatency(40) this time will make enough
of a difference to not bring back reports of degraded performance when
using flip model on Windows 10.
2022-03-08 13:01:09 -08:00
jpark37 63db2265dc libobs, libobs-d3d11, libobs-opengl: Add GS_RG16
This format will be useful for P010 chroma in the future.
2022-01-29 15:12:00 -08:00
Richard Stanway 3240b05cec libobs-d3d11: Fix formatting 2022-01-15 00:38:02 +01:00
Richard Stanway 74b5bed116 libobs-d3d11: Fix incorrect format string
Detected by PVS Studio.
2022-01-15 00:16:39 +01:00
jpark37 b4b396411a libobs-d3d11: Log display nit range
May be useful for setting display range metadata.

Also span info across multiple lines. Single line had become too long.
2022-01-12 05:36:48 -08:00
jpark37 83c89d06b5 libobs-d3d11: Log display color space info
Add DXGI_COLOR_SPACE_TYPE and SDR white level when available for HDR
characteristics.

GetPathInfo/IsInternalVideoOutput functions were copied from MS docs.
2022-01-07 15:18:16 -08:00
jpark37 e77421a805 libobs-d3d11: DuplicateOutput1 for DXGI capture
Despite DuplicateOutput deing documented to always return BGRA8, it is
seen fluctuating between BGRA8 and RGBA16F when HDR is enabled.
DuplicateOutput1 seems to provide a stable format whether SDR or HDR.

Also update the texture recreation logic to check for format changes.
2021-12-21 02:38:42 -08:00
jw0z96 33a6d2a5fd libobs: Expose blending operation types 2021-12-20 09:06:38 -08:00
qiongzai.sun 0d8c98851e libobs: Fix gs_texture_2d::BackupTexture with GS_TEXTURE_CUBE 2021-11-23 20:52:40 -08:00
VodBox c8e417057a libobs, libobs-d3d11: Add support for NT Handle shared textures
Adds support for using shared textures that were made with the
D3D11_RESOURCE_MISC_SHARED_NTHANDLE flag.

This increases the minimum required Windows version to Windows 8 or the
Platform Update for Windows 7. As official support is only for Win 8+
this does not change official support.
2021-11-20 16:34:28 +13:00
jpark37 a9958b96d2 libobs-d3d11: Fix present skip comment
It's about the CPU being ahead of the GPU, not flip queue being full.

Also fix variable typo.
2021-09-15 15:09:25 -07:00
jpark37 608cd3867e libobs-d3d11: Use waitable object to avoid stalls
Skip Present if the waitable object says the swap chain isn't ready.
2021-09-15 02:52:12 -07:00
jpark37 fbe3e7e14b libobs-d3d11: Simplify DXGI factory creation
QueryInterface probably supplies all factories on OS. We'll see.
2021-09-15 02:52:12 -07:00