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.
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.
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.
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.
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.
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.
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.
Reorganize data to avoid best practices layer warning. Sort of a false
positive in our case because we only have one buffer per pool now, but
implicit layers should be clean citizens.
Use general layout and 0 access masks for external synchronization as
specified in the spec.
Also set pipeline stages for maximum synchronization just in case
because it doesn't seem like the pipeline stages are specified.
"Vulkan-incompatible APIs will require the image to be in the GENERAL
layout whenever they are accessing them."
"Whilst it is not invalid to provide destination or source access masks
for memory barriers used for release or acquire operations,
respectively, they have no practical effect. Access after a release
operation has undefined results, and so visibility for those accesses
has no practical effect. Similarly, write access before an acquire
operation will produce undefined results for future access, so
availability of those writes has no practical use. In an earlier version
of the specification, these were required to match on both sides - but
this was subsequently relaxed. These masks should be set to 0."
Don't allow unsupported Vulkan formats to fall back to B8G8R8A8.
Probably better to fail completely than do an illegal copy.
Also remove bad conversion for VK_FORMAT_A2R10G10B10_UNORM_PACK32.
Red and blue channels were reversed, and there's no DXGI equivalent.
Addresses #2796. We can do more later if justified.
Make sure HWND tracking is cleaned up when Vulkan surfaces are
destroyed. Also use unbounded linked list to fix games that leak
surfaces on Alt+Tab like Doom.
Also replace CRITICAL_SECTION with SRWLOCK, both for claimed speed
benefit, and to remove initialization code.
Sometimes the width/height would initially be at 0x0 when the swap chain
was alt-tabbing, causing the capture to fail full-stop when trying to
reacquire.
Game capture assumes the top-level ancestor HWND, not a child HWND.
This fixes bugs such as the VLC window not capturing anymore due to the
fact that the capture HWND of VLC is a child window of the main VLC
window and not the main VLC window itself.