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.
Previously, the loader supported static linking. This capability was restricted
to MacOS only, however the necessary functionality was never implemented. This
commit adds the required code to properly initialize the loader when statically
linked with MacOS
Since the test framework was designed to dynamically load everything, it would
require significant rearchitecting to support it. As such, a simple verification
executable was added to the live_verification folder, instead of full support
in the test framework.
Various situations could cause an OOM to turn into a hard crash due to double freeing
of memory that was improperly cleaned up. Also fixed memory leaks when layers would
report OOM.
Unless the portability enumeration extension is enabled and the create instance flags
contain VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR, do not enumerate drivers that
contain `is_portability_driver` in their JSON Manifest. This is phase 2 of the release
for the VK_KHR_portability_enumeration extension.
An error message will be printed when no drivers were reported but there was a
portability driver which was skipped over.
Add "additive" environment variables for adding additional layer
paths or driver JSON files instead of replacing default ones.
Also, rename VK_ICD_FILENAMES to VK_DRIVER_FILES since we're trying
to remove references to ICDs because software driver implementations
of Vulkan aren't ICDs (but continue to support the old name as well).
Added documentation around these changes to reflect the new name and
the new variables.
The loader trampoline previously would query all devices every time
vkEnumeratePhysicalDevices was called.
To do this, it would make two calls every time:
- First, it would ignore the passed in user values
- Second, it would query the total number of available devices.
- Third, it would query the values for every available device
This resulted in layers reporting 2 vkEnumeratePhysicalDevices call for
every 1 the application made which could get very polluted in output.
It didn't break any functionality, just made things messy.
This change removes that behavior and adds a bunch of test cases to verify
nothing broke in the move.
Validate the Vulkan dispatchable handles (VkInstance, VkPhysicalDevice, etc) for
any trampoline functions the loader uses to query the dispatch table from.
This is so we can at least report errors before something bad happens.
Also, add tests to the test framework to catch this case. Right now they simply
check to make sure we aborted, but they don't know why the loader aborted.
Eventually, we need to come back and check the loader messages and make sure it
aborted for the reasons we want.
Fix a generator warning in dispatch_table_helper_generator.py where a compare was
the wrong type.
Fixes GH Issue #64.
Not all structs declarations in loader.h were moved to loader_common.h. This
caused compilation errors due to not having the struct declaration available
in the headers it was needed.
The only purpose TLS was serving was as a channel for allocation callbacks to
be useable inside cJSON and dirent_on_windows. TLS didn't solve any specific
threading problem. Instead it served as an information channel. On top of that,
the only time when the TLS was used was inside vkCreateInstance as the
pre-instance calls would have the TLS pointer to loader_instance be set to
NULL.
This commit separates the structure definitions from the function declarations.
The reason to do this is to allow splitting of loader.h/.c functionality into
individual headers, which may require access to these structs but don't need to
know about the other functions.
Previously the logic to free all the components of loader_layer_properties was spread
across a half dozen different places, resulting in leaks. This commit moves the logic
into a single location, centralizing the process and making it easier to add new
fields to the loader_layer_properties struct.
Before it was a mix of camelCase, PascalCase, and snake_case.
"Vulkan" functions, like terminator_GetPhysicalDeviceProperties, remain in camelCase.
This way it looks visually similar with the actual vulkan functions they correspond to.
Add logging that will allow end-users to specifically just look at
messages for layers and implementations/ICDs.
Setting VK_LOADER_DEBUG to include one of the following:
- layer : enables layer-specific logging
- implem : enables implementation/ICD-specific logging
The loader_log messages were using the DEBUG_REPORT log levels
which just happened to coincide with the existing LOADER_ log levels.
Going forward, to add layer logging in its own level, this would not
have worked.
Standard validation was changed to khronos validation. This change
moves the warning when illegally using standard validation to an
error that will not allow a user to continue and will tell the user
to use khronos validation.
Change-Id: Iaeae6cffa4494a299f408033569163a7c61d3105
An array of strings was added to the override layer to provide
per-application overrides. The loader will now look for an override profile
which contains an app_key entry that matches the path & name of the currently
running executable. Previous behavior with a global override still works as
intended.
This changes is in conjunction with the VkConfig rewrite to allow for more
than one override profile to be enabled.
Changes to be committed:
modified: loader/loader.c
modified: loader/loader.h
modified: loader/vk_loader_platform.h
Change-Id: I9ddbc98a098d48064110db6c29998eddb336fcda
Previously, if a layer called a pre-instance function
while being initialized (inside vkCreateInstance) a deadlock
would occur because the preload icd call used the same mutex.
Change-Id: I085ecfbcab26d746d77ca8466b4f63a13f6bea10
The ideal of having the loader be stateless causes serious slowdowns
in application startup due to the need to load then unload ICD's
repeatedly while calling pre vkCreateInstance functions. By pre-
loading the ICD's which are found using loader_icd_scan, the
unecessary reloading of ICD's is avoided.
The preloaded ICD's will be unloaded with vkDestroyInstance. This
allows subsequent vkCreateInstance calls to use the most recent ICD
on the system, preventing issue where a new driver was installed
but an application couldn't use it unless they unloaded the loader
library completely.
Changes to be committed:
modified: loader/loader.c
modified: loader/loader.h
modified: loader/trampoline.c
Change-Id: Id169f94bea15e569b75c3a663b25444cc6c52c40
The loader will now make sure to check if utf8 is null before
validating the string, preventing needless segfaults.
Change-Id: I48139e56719e3c518b85f2ded1ca0b682447413f
As VK_EXT_headless_surface is a WSI extension, supporting it
requires changes to the loader. This commit makes the necessary
changes, which are mostly straightforward plumbing.
However, this commit also includes a minor tweak to avoid a
segmentation fault when an implicitly enabled layer provides
support for an instance extension.
Changes:
- Integrate upstream script changes: We have to plumb-through the new
conventions object to continue using the makeCParamDecl utility function
- Add GGP to available platforms
- Add handling for extension dependencies: Previously, the codegen for
loader trampolines could not handle an extension command that depends on
more than one extension being present. This removes that limitation
- Add checks for device extensions: This adds a check for two functions
at device creation time:
* VK_KHR_device_group
* VK_EXT_full_screen_exclusive
The loader needs to know about these extensions for proper handling
of the vkGetDeviceGroupSurfacePresentModes2EXT terminator
- Update known-good file
Updated:
- `loader/loader.c`
- `loader/loader.h`
- `scripts/common_codegen.py`
- `scripts/dispatch_table_helper_generator.py`
- `scripts/helper_file_generator.py`
- `scripts/known_good.json`
- `scripts/loader_extension_generator.py`
- `scripts/loader_genvk.py`
Change-Id: I9f0828a8eee0e8e95b479e1b8feb31acaa10040d
Previously, the override's layer list was treated as an authoritative
list of layers. Now it uses a whilelist/blacklist so the override can
enabled, disable, or leave a layer alone.
Change-Id: I58db219deb2b6355c56aeb2d00187ac79ad531c2
Note that references in scripts/common_codegen.py and
scripts/loader_extension_generator.py will need to be
removed later
Change-Id: I7b17c80f7a06a339d7df0c199ff556212a7c6534
Add support for an override layer in the loader. This allows layers
to be set by an outside application.
Revamp the logic to detect manifest files in the various paths that
we allow them to be placed. This code significantly rewrites
loader_get_manifest_files.
Change-Id: I8abf558864b66eb71ee026ca559b0126cf2fa4e9
This change removes the assumption that vk_layer.h will include
vk_layer_dispatch_table.h, since it will be removed from vk_layer.h
in the near future.
Change-Id: I3fed5efbc35781c96aa9d0977d046c8555e04a7c