Commit Graph

242 Commits (a196fc7824a7b7e4bbf3f4f725a41a2a7787a6e6)

Author SHA1 Message Date
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
jpark37 01b5571c47 libobs-d3d11: Prefer ComPtr Clear() over Release() 2021-09-15 02:52:12 -07:00
jpark37 00941ffc84 libobs-d3d11: Use ALLOW_TEARING if supported 2021-09-11 01:33:55 -07:00
jpark37 7ce2a60a1d libobs-d3d11: Use FLIP_DISCARD on Windows 11
Windows 11 support for DISCARD swap effect seems to be buggy and slow.
Use FLIP_DISCARD instead. Staying with DISCARD on Windows 10 because of
reports of flickering that hopefully won't happen on Windows 11.

We're also not using ALLOW_TEARING because it seems to break after an
OBS cycle of minimize/restore on both Windows 10 and 11. The swap chain
displays a stale image. Not sure if ALLOW_TEARING would be beneficial
even if it was working.
2021-09-10 20:19:24 -07:00
jpark37 5457524f5a libobs-d3d11: Avoid vector usage
Allocations need global heap lock, which is bad.
2021-08-15 00:12:14 -07:00
jpark37 993c46c8a2 libobs-d3d11: Relax texture format copy check
SRGB and non-SRGB formats are compatible for copy.
2021-07-11 08:26:29 -07:00
jpark37 6d59cf19e9 libobs-d3d11: Use typeless texture for duplicator
This allows us to use an SRGB SRV for automatic decompression.
2021-07-11 08:26:29 -07:00
Lin c83eaaa51c libobs-d3d11: Default to Intel IGPU on IGPU+DGPU systems
On systems that have both Intel iGPU and Intel dGPU at the same time,
default/prioritize running OBS the iGPU instead to improve performance.
The user can still choose the dGPU if they change the adapter index, but
the adapter index will now be the second value instead of the first
value. (-Jim)
2021-03-21 22:45:08 -07:00
Lin 1e106c8bb8 libobs-d3d11: Split InitFactory to InitAdapter
Splits off the adapter initialization to its own function so we can
modify what happens in between those actions. (-Jim)
2021-03-21 22:45:08 -07:00
jpark37 c03320cfc2 libobs: Add function to count GPU adapters
Only implemented for D3D11 for now.
2021-03-12 20:59:31 -08:00
Richard Stanway 13cfd95fef libobs-d3d11: Avoid temporary ComPtr objects
The ternary operator promotes both sides to the same type if possible,
so it created and destroyed a temporary ComPtr. Found by PVS Studio.
2021-03-04 19:29:00 +01:00
jpark37 2b652cc763 libobs: gs_duplicator_get_monitor_index
Helper function to find DXGI output index of HMONITOR.
2021-01-26 17:11:04 -08:00
jpark37 66259560e0 libobs: Add dormant SRGB format support
GS_RGBA, GS_BGRX, and GS_BGRA now use TYPELESS DXGI formats, so we can
alias them between UNORM and UNORM_SRGB as necessary. GS_RGBA_UNORM,
GS_BGRX_UNORM, and GS_BGRA_UNORM have been added to support straight
UNORM types, which Windows requires for sharing textures from D3D9 and
OpenGL. The D3D path aliases via views, and GL aliases via
GL_EXT_texture_sRGB_decode/GL_FRAMEBUFFER_SRGB.

A significant amount of code has changed in the D3D/GL backends, but the
concepts are simple. On the D3D side, we need separate SRVs and RTVs to
support nonlinear/linear reads and writes. On the GL side, we need to
set the proper GL parameters to emulate the same.

Add gs_enable_framebuffer_srgb/gs_framebuffer_srgb_enabled to set/get
the framebuffer as SRGB or not.

Add gs_linear_srgb_active/gs_set_linear_srgb to instruct sources that
they should render as SRGB. Legacy sources can ignore this setting
without regression.

Update obs_source_draw to use linear SRGB as needed.

Update render_filter_tex to use linear SRGB as needed.

Add gs_effect_set_texture_srgb next to gs_effect_set_texture to set
texture with SRGB view instead.

Add SRGB helpers for vec4 struct.

Create GDI-compatible textures without SRGB support. Doesn't seem to
work with SRGB formats.
2021-01-21 07:42:13 -08:00
jpark37 c72b5de23e libobs-d3d11: Support typeless textures
In the future, we may share or wrap typeless textures to support SRGB
and non-SRGB views.
2021-01-11 14:18:12 -08:00
jpark37 2d547cf669 libobs: Allow wrapping D3D11 object with gs_texture_t
This can be useful for reading from textures provided by middleware.
2020-11-24 14:39:56 -08:00
jp9000 7993179466 cmake: Add cmake folders 2020-05-13 06:52:37 -07:00
Colin Edwards 55e2985026
Merge pull request #1944 from WizardCM/windows-rc-definition
CMake: Build Windows modules with file descriptors
2020-04-18 18:27:22 -05:00
Richard Stanway 54c5ac250f libobs-d3d11: Log device PCI IDs
This will help identify devices sharing the same names (eg "Intel HD
Graphics") for potentially adding to the blacklists should they have
issues.
2020-03-23 20:54:38 +01:00
jp9000 8ecfb405ce Revert "win-capture, libobs: Show names of displays in Display Capture"
This reverts commit 9931f22ff4.
2020-03-19 06:43:57 -07:00
jp9000 b31c166814 Revert "graphics: libobs-d3d11: Use DXGI_SWAP_EFFECT_FLIP_DISCARD on Windows 10"
This reverts commit 4da73445c3.

This is being reverted because apparently it causes flickering displays
for some people.  Bad drivers or something?  Not sure.  Very annoying.
2020-03-11 09:35:47 -07:00
Matt Gajownik 9931f22ff4 win-capture, libobs: Show names of displays in Display Capture 2020-03-09 11:13:59 +11:00
brittneysclark b8754f89fb libobs-d3d11: Enable NV12 for Intel on newer platforms
Check Intel Device IDs and only disable NV12 on legacy Intel GPUs. NV12
copy times on new platforms (ICL+) is minimal.
2020-02-26 05:49:13 -08:00
jpark37 f27f858ab3 libobs: Support device loss registration
Complex external systems using the D3D11 device may need to perform
their own device loss handling, the upcoming Windows Graphics Capture
support for example.
2020-02-22 21:02:33 -08:00
jpark37 ed91c4e3bc libobs-d3d11: Don't allow volume render targets
Unlikely to be necessary. Disable for simplicity.
2020-01-01 12:40:03 -08:00
Jim 4df9ce0cdf
Merge pull request #2251 from jpark37/lut-volume-texture
Use volume textures for LUT filter
2019-12-29 11:04:20 -08:00
jpark37 b5b6f24d5b libobs-d3d11: Increase the frame queue capacity
Sometimes Present stalls are seen when multiple swap chains are active.
This seems to fix that.
2019-12-19 10:08:21 -08:00
jpark37 8f6984e345 libobs: Add support for volume textures
Also fix some mip calculations along the way.
2019-12-15 14:38:26 -08:00
Jim fa5454d1b8
Merge pull request #2124 from notr1ch/pci-device-ids
Use PCI database IDs instead of string matching for devices
2019-11-22 23:15:55 -08:00
jpark37 1e2542ad6f libobs-d3d11: Fix null input layout rebuild
Don't build input layout without VS inputs. Matches creation logic.
2019-10-17 09:24:13 -07:00
Jim 3e01fdf3e5
Merge pull request #2116 from jpark37/begin-frame
libobs: Add gs_begin_frame for duplicators
2019-10-15 22:23:34 -07:00