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).
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.
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."