0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
Commit Graph

436 Commits

Author SHA1 Message Date
jpark37
b899f06877 graphics-hook: Fix potential D3D12 device leak 2021-05-17 02:28:11 -07:00
jpark37
2e7b0e3340 graphics-hook: Use Detours for D3D12 hook
Will attempt to fully use Detours after 27 ships.
2021-05-17 02:28:11 -07:00
jpark37
4de5863d07 graphics-hook: Link Detours library 2021-05-17 02:28:11 -07:00
jpark37
366b716f20 libobs-winrt,win-capture: Cursor toggle exceptions
A user has reported that toggling the cursor can cause exceptions.

Propagate that information upward, so we can reset the capture.

Display capture never needed to call the function in the first place.

Shuffle around window capture code to make a common reset function.

Builds on PR #4663.
2021-05-07 23:50:13 -07:00
jpark37
3514f4fea5 win-capture: Fix WGC disable index for display
Previously disabled DXGI because the index is wrong.
2021-05-06 13:58:14 -07:00
jpark37
01d065fa7d win-capture: Remove SRGB code
Not having OBS_SOURCE_SRGB is good enough now.
2021-05-03 01:19:56 -07:00
jpark37
78711fa648 win-capture: Add OBS_SOURCE_SRGB flag 2021-05-03 01:19:56 -07:00
jpark37
2472529520 win-capture: Restore GL capture deduplication
Previous fix attempted to place swap_recurse count in gl_data struct,
where it could be unexpectedly memset to 0. Separate member from struct,
and make thread-local for additional safety.
2021-03-31 02:35:22 -07:00
wangshaohui
0069562cca win-capture: Fix window capture stuck last frame
Fixes obsproject/obs-studio#2321
2021-03-30 05:49:43 -07:00
jpark37
7e263ab775 win-capture: Better laptop test for auto-selection
Only auto-select WGC for desktop capture if a battery exists and
multiple GPU adapters are present. May false-positive on desktops with
a smart UPS attached, but we don't know of a better test.
2021-03-12 20:59:31 -08:00
jpark37
17cb0acdd7 graphics-hook: Fix build without COMPILE_D3D12_HOOK
Just need to forward declare D3D12 type.
2021-02-14 22:20:14 -08:00
jpark37
23e9d4153e win-capture: D3D12 swap chain queue usage
Attempt to schedule shared texture copies against the command queue that
the game's swap chain uses to try to reduce artifacts. The heuristics
for obtaining the queue are not perfect, so provide a toggle to use the
previous behavior.
2021-02-14 02:06:02 -08:00
jpark37
80b4a65cd2 win-capture: Add WGC desktop capture
Copy patterns from WGC window capture, and BitBlt monitor capture.
2021-01-26 17:11:12 -08:00
jpark37
db35a022cd libobs-winrt,win-capture: Support desktop capture
Add display capture support via winrt_capture_init_monitor. Almost all
of the existing window capture code is reused.

Rename winrt_capture_init to winrt_capture_init_window for symmetry.
2021-01-26 15:57:20 -08:00
jpark37
a311299606 win-capture: Support linear SRGB
For game capture, neither GL nor D3D9 support SRGB shared textures, so
disable linear SRGB support if the texture format doesn't support it.

Similarly, DXGI display capture doesn't work with SRGB at the moment.
Unsure if it will with more work, but disable for now.

Also force linear SRGB off if using GDI-compatible textures.
2021-01-21 07:42:57 -08:00
jpark37
535f6b0adc win-capture: Typeless game capture textures
Modify game capture shared textures to be typeless if they could
potentially need SRGB and non-SRGB views in the future.

These capture APIs have been updated: D3D 10/11/12, Vulkan.

D3D8 capture does not use shared textures.

D3D9 and GL interop do not support typeless textures.

The new game capture DLL should be compatible with old versions of OBS.

Also removed a lot of dead code around pointless SRV/RTV support.
2021-01-11 14:18:12 -08:00
Gol-D-Ace
7368a2c7cc Update translations from Crowdin 2020-12-14 00:29:44 +01:00
Gol-D-Ace
7ab98ca00f Update translations from Crowdin 2020-11-25 20:11:39 +01:00
jp9000
6d181d97ca win-capture: Update hook version 2020-11-16 14:39:04 -08:00
jpark37
484084abb5 win-capture: Clean up remaining /W4 warnings 2020-11-15 06:03:18 -08:00
jpark37
013dd5a7a3 win-capture: Fix our own Vulkan spec violation
Pass valid instance when looking up VkCreateDevice.
2020-11-14 12:03:36 -08:00
jpark37
a164a75ed6 win-capture: Warning fixes
Add explicit casts to convert data pointers to function pointers.

Add references for unused parameters.

Replace accidental BOOL* return values with BOOL.
2020-11-13 13:21:10 -08:00
jpark37
526c54fbba win-capture: Fix unused variables 2020-11-11 12:02:03 -08:00
jpark37
dad861b036 win-capture: Fix D3D leaks on swap chain release
For game capture, hook DXGI release function to release D3D objects if
the related swap chain is also being destroyed.

An added bonus is that the game capture hook will handle swap chain
recreation for applications that don't use ResizeBuffers.
2020-10-13 18:47:35 -07:00
jp9000
c66fa09b46 win-capture: Update hook version 2020-10-04 11:41:19 -07:00
jpark37
9ba768837b win-capture: Violate Vulkan spec for compatibility
Rivatuner Statistics Server calls vkGetInstanceProcAddr for
vkCreateDevice with a NULL instance. According to spec, this should
return NULL, but RTSS will dereference this and crash.

This change returns function pointers for every intercepted function
regardless of instance, which is enough to keep RTSS alive.
2020-10-03 22:41:11 -07:00
windwakr
884c43f8c0 win-capture: Fix mask handling on some color cursors 2020-10-03 05:55:30 -07:00
Gol-D-Ace
c66ebde080 Update translations from Crowdin 2020-09-27 23:07:27 +02:00
jp9000
107a85cc59 win-capture: Increment graphics hook version 2020-09-09 10:32:57 -07:00
jpark37
7cf148e013 win-capture: Improve game capture messages
Tag debug output in the game process with "[OBS]" and mention that
graphics-hook.dll is ours.
2020-09-08 09:55:46 -07:00
jp9000
bdd6562a94 win-capture: Put window capture update data in a mutex
Because the window capture source updates its data whenever certain
properties are modified, this would cause a race condition because
source updates normally happen in the graphics thread.  To solve this
for the time being, put access to that data within a mutex when updating
or updating visibility.
2020-09-03 05:49:58 -07:00
jpark37
94475b8795 win-capture: Fix Vulkan crash on minimize restore
Set uninitialized data members to avoid crash coming back from minimize.
2020-09-01 20:20:59 -07:00
jpark37
7a66466efc win-capture: Add Vulkan instance creation fallback
Fall back to original arguments if our 1.1 API request doesn't work.
2020-09-01 18:59:13 -07:00
jpark37
e905b4cb6e win-capture: Vulkan variable naming consistency 2020-09-01 18:56:14 -07:00
Jim
6efd70fc01
Merge pull request #3260 from jpark37/vulkan-cts-hack-remove
win-capture: Remove Vulkan CTS workaround
2020-08-27 10:18:08 -07:00
jp9000
bf4a917751 win-capture: Fix excessive window capture logging 2020-08-25 10:18:45 -07:00
jpark37
a713a5b433 win-capture: Robust Vulkan swap chain handling
Not all surfaces support VK_IMAGE_USAGE_TRANSFER_SRC_BIT. Only
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT is required by spec. Add fall back.
2020-08-23 11:23:12 -07:00
jp9000
36f8903da1 win-capture: Update graphics hook version 2020-08-22 13:03:05 -07:00
Ryan Foster
d49e14d8a6 win-capture: Remove unused strings
After PR #3074, the following strings are no longer used:
 * GameCapture.ForceScaling="Force Scaling"
 * GameCapture.ScaleRes="Scale Resolution"

Commits from PR #3074:
 * 9497589b16
 * 6393399758
2020-08-20 02:21:30 -04:00
jpark37
9d177d0969 win-capture: Remove Vulkan CTS workaround
CTS has been fixed, so the workaround is no longer necessary.
2020-08-07 22:58:49 -07:00
jpark37
04b9b9fea3 win-capture: Make Vulkan frame data local to queue
Prevents multiple queues in the same family from racing on frame data.

Removal of vk_family_data also fixes broken capacity calculation. Two
queue families can share the same index if one is "protected-capable"
and the other isn't.
2020-07-26 13:33:01 -07:00
jpark37
e6896d79e3 win-capture: Hide Vulkan linked list internals 2020-07-26 13:32:53 -07:00
jpark37
44fb61b1f2 win-capture: Improve Vulkan hook stability
Make fixes mostly to stabilize CTS. Tested on Windows with RTX 2080 Ti.

Use separate linked-list maps for devices and queues.

Process queues upfront in OBS_CreateDevice, and not lazily in
OBS_GetDeviceQueue.

Handle failed node allocation for OBS_CreateInstance, OBS_CreateDevice,
and OBS_CreateSwapchainKHR.

Handle VK_NULL_HANDLE for OBS_DestroySurfaceKHR and
OBS_DestroySwapchainKHR.

Add temporary code path CTS_WORKAROUND to deal with CTS sharing surfaces
between instances.

Fix return value for OBS_DestroyInstance.

Add missing _freea calls, required for _malloca.

Make sure the queue passed to OBS_QueuePresentKHR supports transfer to
safely call vkCmdCopyImage.

Update GetInstanceProcAddr/GetDeviceProcAddr to conform closer to spec.

Remove extra macros because I dislike indirection more than verbosity.
2020-07-24 09:30:05 -07:00
Jim
cd865a0be8
Merge pull request #3150 from jpark37/vulkan-dynamic-arrays
win-capture: Remove fixed-size Vulkan arrays
2020-07-18 10:46:22 -07:00
Matt Gajownik
0e07e034a0 win-capture: Log duplicator display when updating properties 2020-07-14 22:40:15 +10:00
jpark37
afbad3b337 win-capture: Remove fixed-size Vulkan arrays
Use linked lists in place of fixed-size arrays in an attempt to fix
behavior when programs generate lots of non-resource objects.
2020-07-10 20:41:00 -07:00
Jim
5728df6cef
Merge pull request #3149 from jpark37/vulkan-32bit
win-capture Fix 32-bit Vulkan capture
2020-07-10 20:39:13 -07:00
Jim
97ecf23df0
Merge pull request #3121 from jpark37/chrome-window-priority
win-capture: Don't use Chrome classes for priority
2020-07-10 20:20:26 -07:00
Jim
6c37f6faea
Merge pull request #3113 from jpark37/vulkan-swap-decouple
win-capture: Decouple swap and frame indices
2020-07-10 20:15:38 -07:00
jpark37
7772a56a97 win-capture: Fix 32-bit Vulkan capture
Vulkan loader needs pure name, which needs manual fix-up on 32-bit.
2020-07-09 22:10:34 -07:00