193 Commits
Author SHA1 Message Date
Warchamp7andRyan Foster 30b63c6849 Update C++ files with braces 2026-06-09 13:41:19 -04:00
Malcolm BechardandRyan Foster 343ae6015a graphics-hook: Fix crash with Vulkan DirectDisplay
Vulkan Direct Display uses extensions:
VK_KHR_display/VK_EXT_direct_mode_display
This workflow allows creating swapchains that arn't active on the
desktop, so they don't have HWNDs.
Avoid trying to create swap_data when a HWND can't be found.

Fixes #11581
2025-04-23 17:24:29 -04:00
PatTheMavandRyan Foster df97bddd87 cmake: Update cross-platform build project management for Windows
Enables creation of x64 and x86 child projects when building on ARM64
and decouples functionality from legacy_check function
2025-03-12 16:33:00 -04:00
confusionattackandLain 4652daf748 win-capture: Avoid NULL deref when capture not initialized 2024-11-16 11:32:10 -08:00
Charlese2andRyan Foster 0b87f533b2 graphics-hook: Fix null pointer dereference
Multiple APIs may be set up to capture without being initialized in
graphics-hook when multiple threads are sending present calls. This just
prevents those invalid captures from completing.
2024-10-31 12:46:04 -04:00
Ryan Foster a1fbf1015f clang-format: Increase column limit from 80 to 120 2024-10-04 18:19:27 -04:00
PatTheMavandRyan Foster 6c590805e8 cmake: Update supported CMake version range to 3.28 and 3.30 2024-09-13 14:42:32 -04:00
Scott CooperandLain dfe6151465 win-capture: Fix segfault when calling data.free()
data.free should be checked before calling.
2024-09-07 16:09:03 -07:00
PatTheMavandRyan Foster 46b5f7e6d0 plugins: Remove CMake legacy code paths for Windows modules 2024-08-22 15:39:00 -04:00
PatTheMavandRyan Foster d81fcd70e0 cmake: Update cross-platform build project management for Windows
Enables creation of x64 and x86 child projects when building on ARM64
and decouples functionality from legacy_check function
2024-08-20 16:00:21 -04:00
PatTheMavandRyan Foster b8cfacaec3 Update formatting of CMake files 2024-08-14 12:07:47 -04:00
tytan652 4b0b71ad5f deps,shared,win-capture: Move ipc-util to shared folder 2024-07-27 07:38:36 +02:00
PatTheMavandRyan Foster 14654807cb win-capture: Add missing MSVC runtime setting to 32-bit build 2024-03-16 19:36:33 -04:00
PatTheMavandRyan Foster f4733ec6a2 Update source code formatting with clang-format 17.0.3
Added SCDisplayRef type alias to fix a quirk of this specific
clang-format version with ObjC block syntax.
2024-03-11 15:55:30 -04:00
PatTheMavandRyan Foster eae5cc1e38 plugins: Update CMake formatting with manual format choices 2023-12-19 17:59:44 -05:00
jpark37andLain ea9df85512 graphics-hook: Fix DXGI ref leak for D3D12 capture
Create ID3D11Resource dynamically to avoid reference inflation.
2023-12-16 17:03:43 -06:00
jpark37andLain 263e027938 graphics-hook: Remove unused member variables 2023-12-10 04:45:33 -06:00
jpark37andLain 395ab0fbf5 graphics-hook: Use ID3DDestructionNotifier
Cleaner and more correct than hooking IUnknown::Release.
2023-12-10 04:45:33 -06:00
Seth WilliamsandLain aa1f2dea84 win-capture: Fix Vulkan race condition
This race condition is caused when one thread creates a swap chain,
which calls OBS_CreateSwapchainKHR, at the same time another thread
calls OBS_CreateImageView.

OBS_CreateSwapchainKHR allocates swap data, publishes this into the
data->swaps linked list, then initializes it. Meanwhile,
OBS_CreateImageView is iterating the swaps linked list, to see if the
image matches any swap chain images. Due to the order in
OBS_CreateSwapchainKHR, there's no guarantee this data is initialized
so it often ends up running out of bounds on the swap_images array.

The fix is simply to defer the swap data publish to after init.
2023-11-07 23:48:34 -06:00
jpark37andLain b5c5f71cee graphics-hook: Handle VkImageViewUsageCreateInfo
Our solution for adding TRANSFER_SRC usage for imageless framebuffers
was triggering validation errors when combined with image view usage
overrides. Add TRANSFER_SRC onto usage overrides for swap chain image
views to fix mismatches.
2023-08-04 03:35:10 -07:00
Carl PédiminaandLain b12ed3008b win-capture: Fix leaking framebuffers data
The wrong linked list was used when removing framebuffer data.
Furthermore, a pointer referenced an object on the stack that
was no more valid.
2023-07-25 10:48:10 -07:00
PatTheMavandRyan Foster 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
Lain 106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
PatTheMavandRyan Foster 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
jpark37andJim feae65c472 graphics-hook: Handle VK_KHR_imageless_framebuffer
Applications that use this Vulkan extension would have image usage
mismatches because we add VK_IMAGE_USAGE_TRANSFER_SRC_BIT to
VkSwapchainCreateInfoKHR::imageUsage, so make the same modification to
VkFramebufferAttachmentImageInfo::usage.
2023-03-24 15:17:43 -07:00
jpark37andJim 148122f5aa graphics-hook: Stop trying to connect early
It never works, and leaves a confusing message behind.
2023-02-04 15:44:16 -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
PatTheMav b417df7d95 win-capture: 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:28 +01:00
jpark37andJim afeb78e022 graphics-hook: Print DXGI swap chain desc 2022-09-10 15:36:53 -07:00
jpark37andJim 5fd22f3dfd graphics-hook: Remove unused code 2022-09-10 15:36:53 -07:00
jpark37andJim f55021be90 graphics-hook: Bump Vulkan version
Vulkan loader blocks implicit layers older than application apiVersion.
2022-07-29 23:22:39 -07:00
jpark37andJim 8a4352c1e5 graphics-hook: Relax Vulkan allocation strategy
Stop requiring DEVICE_LOCAL. May be needed for integrated GPUs.
2022-07-29 23:22:39 -07:00
jpark37andJim b7d630af6b graphics-hook: Update VkResult strings 2022-07-29 23:22:39 -07:00
jpark37andJim 4c7c1854bd graphics-hook: Track DXGI status with counter
Previous approach could mark Present exit too early.
2022-07-29 21:54:28 -07:00
Eric LabergeandJim dfb9bb74f7 graphics-hook: Avoid conflict between Vulkan and DXGI Present 2022-07-29 21:54:07 -07:00
jpark37andJim 69ff026647 libobs, win-capture: Share window helper code
Add "ms_" prefix as makeshift namespace.
2022-07-23 17:41:34 -07:00
PatTheMavandRyan Foster 9145e3063d win-capture: Fix subprojects not installing on incremental builds
When changing a subproject (e.g. graphics-hook), the generated binaries
are not installed without also building win-capture. This commit enables
the subprojects to be treated as "plugins" which are installed to rundir
and also the installation directory without any additional workarounds.
2022-07-13 15:52:13 -04:00
jpark37andJim df96e68ca6 cmake: Disable LNK4099 warning
We are very unlikely to ship PDBs for deps.
2022-07-11 22:07:10 -07:00
PatTheMav d42c98fa22 win-capture: Fix added resources not properly copied to rundir
The `add_target_resource` function uses unnecessary path components
when copying files to the rundir, resulting in files added that way
not to end up where OBS expects them to.

The generated binaries created by sub-targets also need to be copied
as part of `win-capture`'s data files, which was easy to fix as the
target exists before CMake switches into the subdirectories.
2022-03-30 11:10:54 +02:00
PatTheMav 49e9d49943 plugins: Update CMakeLists.txt for included plugins 2022-03-16 23:11:08 +01:00
jpark37andJim 40cea9ca50 win-capture: Remove dependency on psapi.lib 2021-09-12 14:10:36 -07:00
JimandGitHub 84bf08c171 Merge pull request #4720 from jpark37/detours-integration
Finish Detours integration for remaining game capture APIs
2021-08-23 23:18:10 -07:00
kokoleandJim dd6dd4e104 win-capture: Fix D3D12 third party overlay capture
Doesn't make sense to grab the oldest frame when not capturing overlays,
because the overlay was already rendered in it. This will grab the
latest frame (before the overlay is rendered).
2021-08-17 08:24:57 -07:00
jpark37andJim 0f2c1447ab graphics-hook: Fix D3D11On12 usages
Use D3D12_RESOURCE_STATE_PRESENT for CreateWrappedResource arguments. We
should assume the application will set the backbuffer to PRESENT, and
expect that to be preserved across the Present() call.

Remove unnecessary calls to ReleaseWrappedResources.

Clean up (void**) casts with modern patterns.
2021-08-15 15:58:09 -07:00
jpark37andJim 0ffcb66526 graphics-hook: Add Detours include dir 2021-05-19 19:52:49 -07:00
jpark37 57f9c61069 win-capture: Remove custom function hooking
Detours seems to be more stable.
2021-05-18 12:51:01 -07:00
jpark37 452ee646e1 graphics-hook: Use Detours for function hooking
Helped D3D12 path recover from window mode changes, so we assume it
should be more stable across the board for all API hooks.
2021-05-18 12:51:01 -07:00
jpark37 492f4c05e1 graphics-hook: Remove unused header 2021-05-18 12:51:01 -07:00
jpark37andJim 924d9a7d9c win-capture: Remove D3D12 fix toggle
The new D3D12 path seems stable enough. Remove the old path.
2021-05-18 12:47:25 -07:00
jpark37andJim c6cee82c92 graphics-hook: Try multiple D3D12 queues
Keep trying queues until one of them passes D3D11On12CreateDevice.
2021-05-17 02:28:11 -07:00