While the adding and removing of data from this global linked list
was guarded, GetInstanceProcAddr & GetDeviceProcAddr did not have
such guards. This results in race conditions that were detected with
thread sanitizer. This commit adds a mutex solely for the
loader.instances global variable.
Instance extensions are aggregated, therefore an application has no way of
knowing whether an ICD supports a WSI function or not. This necessitates
returning instead of aborting from WSI functions, as well as writing 0,
NULL, or returning false as needed for each function. This also needs
additional NULL checks before calling down into the driver.
These libraries will always be loaded in vkCreateInstance, so we don't
need to load them again in vkCreateDevice. This has the added benefit
of not printing 'unloading library X' twice in the log.
This change makes the loader conform to the latests specification
update, 1.3.227, which removes the requirement that implicit layers
API version is at least as high as the application provided API
version.
This change reduces friction for layer developers and API users.
It should be the same name so mingw-w64 toolchains can generate/use the same
DLLs as the MSVC toolchains. The DLL and import libraries are compatible both
ways.
Fixes#997
Check for the existence of the alloca.h header and only use it it exists,
otherwise fallback to stdlib.h. Some OS's like macOS and QNX have both
headers and can use either (stdlib.h includes alloca.h), some OS's like
OpenBSD / FreeBSD / NetBSD do not have the alloca.h header and require
the stdlib.h header.
Some functions in the wrapping test layer exported functions that are not necessary.
This caused some warnings in builds. Removing them fixes the warnings.
Put all of the parsing for ICD Manifest data into a separate function.
This cleans it up by not requiring manual tracking of allocated resources
while parsing, and allow much saner 'skipping' of incorrect ICD's.
This commit also addresses an issue where OOM during ICD parsing wasn't
immediately ending parsing and returning.
Re-add previously reverted behavior that allows layers to setup dispatch chains for unknown physical
device and device functions during vkCreateInstance. Previously, functions not known to the loader could not
be queried by a layer during vkCreateInstance (when dispatch tables should be setup). The change adds support
for unknown functions in the trampolines of vkGetInstanceProcAddr and vkGetPhysicalDeviceProcAddr.
Unknown Device functions not listed in a layers manifest will now be found through vkGetInstanceProcAddr,
which was previously not used.
Use more correct terminology for the various terminators of the
get proc addr functions. This makes it more obvious when each function
is being called, as well as removing the unecessary
loader_gpdpa_instance_internal.
There was a small issue with the initial version of the portability
enumeration extension where the portability enumeration flag bit would
be passed down to ICDs which did not expect flags to contain anything
other than zero.
While an argument could be made for those drivers to ignore flags they
do not recognize, just like extensions and other 'unknown' things, it
is best to play nice as this is the first instance creation flag bit
added.
loader_make_Version previously would decode the major, minor, and patch info out of version data. This results in
erroneous version checks that took into account patch version when they shouldn't of. The loader_make_full_version
function is introduced for code that wishes to get the full major.minor.patch version and uses of
loader_make_version that need the full version have been replaced.
Replace memcpy with memmove in terminator_CreateInstance to prevent possible issues
with the same memory being the source of the copy and the dest, as there is a for
loop which makes it possible for that to happen.