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.
After PR #3074, the following strings are no longer used:
* GameCapture.ForceScaling="Force Scaling"
* GameCapture.ScaleRes="Scale Resolution"
Commits from PR #3074:
* 9497589b1603dcacf07e3b81d2f60291eafb3590
* 63933997586bf88c862159bf5cb20be56b713283
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."
All strings were treated as partial matches before, which caused a
false positive with any executable beginning with "time", notably
affecting the game "Timelie" which used Timelie.exe.
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.
As os_gettime_ns() gets large the current scaling methods, mostly by casting
to uint64_t, may lead to numerical overflows. Sweep the code and use
util_mul_div64() where applicable.
Signed-off-by: Hans Petter Selasky <hps@selasky.org>
This fixes a bug where games like "Don't Starve Together" wouldn't
capture because their actual render window is a completely different
window than their actual window on the screen.
So, because we already have the hook info by this point with the last
known window handle available, instead of using 0 here, we can just use
the window handle provided by the shared memory. And we didn't even
have to change the hook! That's nice.