Commit graph

279 commits

Author SHA1 Message Date
Ryan Foster a1973ea952 libobs-d3d11: Use OS D3DCompiler_47.dll in legacy CMake
Follow-up to 972e24df79.
2024-04-03 14:44:39 -04:00
Kurt Kartaltepe 3e49e89611 libobs,libobs-opengl,libobs-d3d11: Add opengl gs_enum_adapters
This adds gs_enum_adapters and gs_get_adapter_count to the opengl
backend and promotes these to multiplatform graphics functions.

However we need to make an internal device change, device_enum_adapters
must pass in the current device on opengl to ensure that adapter #0 is
the display adapter. We do this to avoid changes to plugins already
checking against obs_video_info.adapter which is always 0 and expected
to be the device OBS was initialized on.

The actual implementation reports the dri render node (or /Software).
This allows plugins to query non-video features of the adapters like
VA-API/NVENC/etc or other cross device functionality. `/Software` is
chosen to avoid opening random files in the current directory if its
passed along as a file path like the regular dri render nodes.
2024-01-27 17:51:33 -06:00
jpark37 a8866fe3fa libobs-d3d11: Remove new/delete replacements
MSVC noticed inline is not allowed, and new/delete replacments also
don't belong in a header file. We're also just leaning on
__STDCPP_DEFAULT_NEW_ALIGNMENT__ being 16 for MSVC x64 now.
2024-01-11 04:02:31 -06:00
PatTheMav c4ce85802b libobs-d3d11: Remove unnecessary quoting of CMake generator expression 2023-12-19 17:59:44 -05:00
jpark37 a372f3f111 libobs-d3d11: Add display primaries to the log
Can't hurt to know what Windows thinks the mastering primaries are.
2023-12-10 04:45:22 -06:00
Richard Stanway 1641812580 libobs-d3d11: Add checksum to shader cache
A few reports came in of cache files with the correct size but full of
null bytes, presumably from a system crash and an SSD lying about buffer
flushes. This commit adds a checksum at the end of the compiled bytecode
so we don't try to use invalid data.

Co-Authored-By: derrod <dennis@obsproject.com>
2023-11-20 04:32:56 -06:00
jpark37 972e24df79 libobs-d3d11: Use OS D3DCompiler_47.dll
OBS needs Windows 10 minimum these days, so the DLL will be there.
2023-11-18 17:17:25 -06:00
derrod 433912f04a libobs-d3d11: Log VRAM in GiB 2023-10-14 18:47:49 -05:00
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