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.
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.
Certain UWP programs can't obtain a normal window handle from their API
for whatever reason (this was observed with minecraft win10 edition), so
if the normal window handle on the map fails, try window handle 0
instead.
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.