Charles Giessen [Fri, 28 Apr 2023 18:59:41 +0000 (12:59 -0600)]
Add helper parsing functions to cJSON
Since parsing an array of strings and strings from json files is very common,
this commit adds helper functions to do exactly that.
Charles Giessen [Wed, 26 Apr 2023 22:52:00 +0000 (16:52 -0600)]
Refactor loader_log for clarity and performance
Use strncat more efficiently by always starting at the place where the last
character was written. Also does not strncat the message and instead writes
that directly to the output stream. This allows shortening the character
buffer since the max possible length for the prefix is the only thing
written.
Charles Giessen [Wed, 26 Apr 2023 22:47:25 +0000 (16:47 -0600)]
Rename log level to reflect its global status
The log level is set only during dynamic initializatoin, rather than during any
specific vulkan call. This commit renames the log to reflect this global
nature of the debug level.
Charles Giessen [Tue, 25 Apr 2023 23:20:36 +0000 (17:20 -0600)]
Make cJSON not add double quotes to strings
In JSON, strings are surrounded with double quotes. Because the loader is
only using cJSON_Print to 'get' the underlying string, we have to strip away
the quotes. To do that, we have to create a new string and copy it over. That
is unnecessary if cJSON didn't add the quotes in the first place. This commit
does just that, but leaves the original code commented out in case it needs
to be reverted.
Note that in many places the loader still does a strcpy to place the string
into a char array, but this commit seeks to do the minimal set of changes to
accomplish the stated goal. Removing the rest of the strcpy's would require
more invasive work to make sure all the char*'s are deleted when they should
be.
Charles Giessen [Tue, 25 Apr 2023 20:32:00 +0000 (14:32 -0600)]
Move loader_get_json to cJSON
Since opening a json file and reading it into a cJSON structure is done in
every source file that wishes to read json files, it is helpful to pull the
loader_get_json function into the source file.
Charles Giessen [Mon, 24 Apr 2023 18:28:49 +0000 (12:28 -0600)]
Add FrameworkSettings to more easily configure the framework
Introduce the FrameworkSettings struct to allow tests to easy and clearly
configure the basic settings of the FrameworkEnvironment. The previous
method just used overloaded constructors which is difficult to read compared
to an explicit structure that contains all the settings.
Charles Giessen [Fri, 21 Apr 2023 23:23:41 +0000 (17:23 -0600)]
Create Dummy function just for windows_initialization
The function call to get the current dll on windows requires the address of a
function inside the dll. Rather than use loader_debug_init, create a dedicated
function for this purpose.
juan-lunarg [Mon, 29 May 2023 19:18:48 +0000 (13:18 -0600)]
ci: Test pkg-config and installation
closes #1204
juan-lunarg [Mon, 29 May 2023 19:30:04 +0000 (13:30 -0600)]
cmake: Don't install GTEST along with vulkan loader
juan-lunarg [Mon, 29 May 2023 17:06:04 +0000 (11:06 -0600)]
cmake: Add LOADER_CODEGEN
juan-lunarg [Mon, 29 May 2023 17:05:40 +0000 (11:05 -0600)]
docs: Document LOADER_CODEGEN
juan-lunarg [Fri, 26 May 2023 17:42:53 +0000 (11:42 -0600)]
LOADER_USE_UNSAFE_FILE_SEARCH
Make LOADER_USE_UNSAFE_FILE_SEARCH a CMake option.
Allows validation layers to disable safe search to work around
permissions issues on Github Actions.
Charles Giessen [Sat, 20 May 2023 22:01:48 +0000 (16:01 -0600)]
Add a test for loader_gpa_instance_terminator
When loader_gpa_instance_terminator is called during vkCreateDevice, it should
use the terminator functions for the instance, which gets stored in struct
loader_instance's terminator_dispatch. This test is accomplished by querying
vkEnumerateDeviceExtensionProperties using the vkGetInstanceProcAddr provided
by chainInfo->u.pLayerInfo->pfnNextGetInstanceProcAddr and comparing the
function pointer with the one queried during vkCreateInstance.
Charles Giessen [Sat, 20 May 2023 21:52:27 +0000 (15:52 -0600)]
Make ChainInfo nextGIPA work in vkCreateDevice
Layers are given chainInfo during instance and device creation. This contains
vkGetInstanceProcAddr (GIPA) that corresponds to the next layer in the chain,
and if there is none, the loader's GIPA terminator. During vkCreateInstance
the instance dispatch table contains the terminators for instance functions.
After vkCreateInstance returns up the call chain, these terminators get
overwritten by calling GIPA on the first layer in the chain.
The problem is that after vkCreateInstance, the instance dispatch table
is being used by loader_gpa_instance_terminator, resulting in the wrong
function being returned to a layer who calls it.
This problem typically only shows up during vkCreateDevice, because the
chainInfo is given to each layer and that chainInfo contains a "nextGIPA".
Except, only the last layer gets a pointer to loader_gpa_instance_terminator,
as every other layer gets the GIPA of the next layer in the chain. Still,
this last layer should not be getting a pointer to the first function in
the chain.
The solution is to stash the terminator dispatch table after returning up
the vkCreateInstance chain but before overwriting the dispatch table with
the first layer in each function chain. Then, inside of
loader_gpa_instance_terminator check if we are still inside of
vkCreateInstance or not.
Charles Giessen [Sat, 20 May 2023 21:48:04 +0000 (15:48 -0600)]
Modify test layer binary names correctly
When creating test layer binaries, the test framework appends a unique
identifier, specifically `_X` where X is a unique number.
Previously, this was appended at the very end, like so:
`libtest_layer.so_0`
Now, the `_X` is added before the file extension, like so:
`libtest_layer_0.so`
Charles Giessen [Thu, 18 May 2023 21:47:11 +0000 (15:47 -0600)]
Make loader_get_icd_and_device check for a NULL device
When loader_get_icd_and_device() is called with a NULL device handle, this
results in comparisons with NULL. If loader_get_dispatch(dev-icd_device) also
returns NULL (due to it being the wrong icd) then loader_get_icd_and_device
will compare NULL to NULL, get true, and return the wrong icd.
Simply checking if loader_get_dispatch(device) is NULL then returning NULL
immediately prevents this situation.
Charles Giessen [Thu, 18 May 2023 21:34:30 +0000 (15:34 -0600)]
Fix crash from layers creating devices on different physical devices
The magic value for the device dispatch table was being set after calling down
the layer chain rather than before. This is wrong because of the situation when
layers create devices from different physical devices, the magic value using
the default value of zero means that loader_get_icd_and_device will return the
wrong loader_icd_term, leading to crashes elsewhere.
The fix is to set the magic value right after the dispatch table is allocated.
This commit adds tests for both drivers being created from the same physical
device and from different physical devices.
Geoff Lang [Tue, 16 May 2023 15:59:30 +0000 (11:59 -0400)]
Don't export Vulkan functions when building the loader statically
If the loader is linked statically, there is no need to export all
vulkan functions from the linking application. This issue showed up
in ANGLE which would export all GLES and Vulkan functions on Mac.
Charles Giessen [Tue, 16 May 2023 21:06:59 +0000 (15:06 -0600)]
Added libgcc-s1:i386 to linux-32 Github actions
Also split out the setup commands into separate run statements rather than
have them string together.
juan-lunarg [Mon, 8 May 2023 18:13:48 +0000 (12:13 -0600)]
cmake: Fix LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING
juan-lunarg [Mon, 8 May 2023 18:26:30 +0000 (12:26 -0600)]
ci: Test LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING
juan-lunarg [Sat, 6 May 2023 00:11:11 +0000 (18:11 -0600)]
Fix LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING WIN32 support
juan-lunarg [Thu, 4 May 2023 18:54:38 +0000 (12:54 -0600)]
ci: Test Ninja build
juan-lunarg [Thu, 4 May 2023 18:53:45 +0000 (12:53 -0600)]
scripts: Incorporate latest changes from VVL
Improves build performance.
Fixes bug preventing Ninja on Windows usage.
juan-lunarg [Fri, 5 May 2023 16:45:27 +0000 (10:45 -0600)]
cmake: Cleanup unicode logic
juan-lunarg [Fri, 5 May 2023 17:22:11 +0000 (11:22 -0600)]
ci: Add concurrency functionality
juan-lunarg [Thu, 4 May 2023 19:12:47 +0000 (13:12 -0600)]
docs: Update README.md
Mike Schuchardt [Thu, 4 May 2023 17:24:21 +0000 (10:24 -0700)]
build: Update to header 1.3.250
- Update known-good
- Generate source
juan-lunarg [Wed, 3 May 2023 18:37:26 +0000 (12:37 -0600)]
loader: Add win32 support for DYNAMIC_LIBRARY_UNLOADING
Mike Schuchardt [Thu, 27 Apr 2023 16:05:54 +0000 (09:05 -0700)]
build: Update to header 1.3.249
- Update known-good
- Generate source
Cathal Corbett [Sat, 22 Apr 2023 08:03:09 +0000 (09:03 +0100)]
Update loader cmake lists to use PROJECT_SOURCE_DIR over CMAKE_SOURCE_DIR.
Change-Id: I5c9c62772182f401833db9dd9b9471a5b177d630
Charles Giessen [Mon, 24 Apr 2023 22:19:48 +0000 (16:19 -0600)]
Add tests to preserve buggy query of vkCreateDevice
Insure that this bug is properly preserved and not accidentally fixed.
Charles Giessen [Mon, 24 Apr 2023 21:54:09 +0000 (15:54 -0600)]
Add compatibility bug for RTSS when querying for vkCreateDevice
The Riva Tuner Statistics Server (RTSS) layer depenended upon a loader bug
which was to allow layers to query vkCreateDevice from loader_gpa_instance_terminator
with a NULL VkInstance handle. Since this bug has been in the loader since pretty
much the start of Vulkan, it is infeasible to fix. For that reason the
inconsistency with the spec is preserved.
Mike Schuchardt [Thu, 20 Apr 2023 16:11:36 +0000 (09:11 -0700)]
build: Update to header 1.3.248
- Update known-good
- Generate source
Charles Giessen [Thu, 20 Apr 2023 17:18:02 +0000 (11:18 -0600)]
Fix debug extension function loading
This commit fixes the loader to check for the debug_utils extension being
enabled before returning functions, fixes the tests to properly check for
the functions when using both Get*ProcAddrs, and enhances the test framework
to support querying for the debug marker extensions.
The debug_utils functions are special because they are from an instance level
function. That means it is always possible to check if the extension that makes
them available is enabled from both vkGetInstanceProcAddr and
vkGetDeviceProcAddr. The loader was previously always returning valid functions
for some of the debug_utils functions when the extension was not enabled, and
this commit fixes that.
The debug_marker extension is a bit different, since it is a device level
extension. Thus, querying the functions from vkGetInstanceProcAddr should
always exceed - as we don't yet know if the extension was enabled or not.
Charles Giessen [Sat, 25 Mar 2023 01:30:39 +0000 (19:30 -0600)]
Cleanup macro usage
* Replace #ifdef <> with #if defined(<>)
* Replace #ifndef <> with #if !defined(<>)
* Add #elif defined(__linux__) || defined(__APPLE__) instead of just having a
naked #else block.
* Add warnings to the new block to indicate that it should be changed when
a new platform is being added. Several places before had the #if WIN32 #else
which inherently assumes that everything in the #else block is supported, when
in reality it was for unix
* Add COMMON_UNIX_PLATFORMS macro define for convenience
* Fix a few auto-gen places where None was printed by mistake
Charles Giessen [Fri, 24 Mar 2023 23:56:37 +0000 (17:56 -0600)]
Remove unnecessary static in source
The `static` specifier is used inconsistently throughout the codebase. This
commit removes it from most places where it is unnecessary. Static's purpose
is to make any function defined inside of a translation unit unuseable from
other translation units. But because we use header files to define which
functions are exposed, we can simply omit static for functions private in a
translation unit.
This commit also removes static in a couple of places where it isn't needed,
such as local variables that do not act as storage beyond the scope of the
function, and for global variables defined inside of implenetation files.
Uses of static in header files, such as vk_loader_platform.h, is left as is
because those functions need static to prevent multiple definition errors.
Charles Giessen [Tue, 18 Apr 2023 19:40:33 +0000 (13:40 -0600)]
Log ERROR when layers in VK_INSTANCE_LAYERS are missing
It is unhelpful to have zero diagnostics emitted when the layers listed in
VK_INSTANCE_LAYERS are not found.
Charles Giessen [Fri, 24 Mar 2023 23:28:55 +0000 (17:28 -0600)]
Move vk_dispatch_table_helper.h to tests
vk_dispatch_table_helper.h will no longer be generated for every new header
version because it is not used in the loader source. Rather, it was only being
used for the tests. This commit moves it to tests/framework/layer where it is
being used. While the python generation code could have been updated to write
it into a different folder, due to the difficulty of that change, it is simpler
to just move the file and stop autogenerating it. The code to generate it is
left as is in case there is a need to update it in the future.
Mike Schuchardt [Thu, 13 Apr 2023 16:30:51 +0000 (09:30 -0700)]
build: Update to header 1.3.247
- Update known-good
- Generate source
Charles Giessen [Thu, 6 Apr 2023 19:10:48 +0000 (13:10 -0600)]
Use Ubuntu 22 in github actions
Remove the unneded pkg-config-i686-linux-gnu package since its gone in 22.
Charles Giessen [Fri, 31 Mar 2023 23:26:07 +0000 (17:26 -0600)]
Fix ordering regression for VK_INSTANCE_LAYERS
The commit to add VK_LOADER_LAYERS_ENABLE/DISABLE inadvertently broke the
ordering guarantees of VK_INSTANCE_LAYERS. This commit restores that order.
If both VK_INSTANCE_LAYERS and VK_LOADER_LAYERS_ENABLE add layers, the order
will be VK_INSTANCE_LAYERS enabled layers, in the order specified by the
env-var, followed by any layers enabled by VK_LOADER_LAYERS_ENABLED enabled in
the order they are found on the system.
In addition to this, the test framework receieved two changes:
* Make env-var folders report their contents in a deterministic order (aka the
order the items were added to the framework). This mirrors existing behavior
for redirected folders.
* Make platform shim resilient to shutdown ordering issues. Namely, set a flag
during shutdown so that any interception functions go straight to the real
version of the functoin. This works around an issue during the destruction of
the FolderManagers for the environment variables, where the readdir shim
function was trying to use the FolderManager's data but Address Sanitizer
declared that such a use was 'heap use after free'.
* Rename set_path to set_fake_path to better indicate its purpose
Charles Giessen [Wed, 29 Mar 2023 20:05:44 +0000 (14:05 -0600)]
Make correct layer be used when duplicates are present
When there are multiple versions of the same layer found through environment variables
or from implicit layer locations, the loader would use the *last* one that appeared rather
than the first, causing surprising behavior. This commit fixes that by checking to make
sure that layers do not already exist in the list of layers to be enabled before adding a
layer to the list, preventing duplicates from appearing in the list.
This commit adds a check in vkEnumerateInstanceLayerProperties to skip over layers that do
wish to intercept the function. The missing check would only cause a spurious log message
which said that the loader was unable to load a symbol names "" (as in an empty string)
from the layer.
This commit also amends the test framework with the following fixes:
* Create Layer JSON manifests that contain multiple layers
* Only add layers to the registry if they are generic (meant to simulate installed layers)
* Allow layers to print messages during vkCreateInstance - a mechanism to double check that
only the correct layer(s) are loaded
* Fixes env-var added layers not using full paths
* Only have 1 XDG env-var set, making all other XDG env-var have an empty string
* Set the XDG env-vars even on macOS (github actions seems to have them set)
Mike Schuchardt [Fri, 31 Mar 2023 14:56:04 +0000 (08:56 -0600)]
build: Update to header 1.3.246
- Update known-good
- Generate source
Charles Giessen [Wed, 29 Mar 2023 20:10:04 +0000 (14:10 -0600)]
Add 4th component to version in loader.rc
FILVERSION is supposed to be a 4 component field. The previous commit to make loader.rc
be generated did not account for that and so requires this fix to make sure it has four
components. Thankfully, this issue is not present in SDK released loaders thanks to the
SDK specifying its own version string that has 4 components.
Mike Schuchardt [Fri, 24 Mar 2023 17:18:22 +0000 (10:18 -0700)]
build: Update to header 1.3.245
- Update known-good
- Generate source
Mike Schuchardt [Mon, 20 Mar 2023 04:59:15 +0000 (21:59 -0700)]
build: Update to header 1.3.244
- Update known-good
- Generate source
Charles Giessen [Wed, 15 Mar 2023 23:59:07 +0000 (17:59 -0600)]
Refactor terminator_EnumerateDeviceExtensionProperties
This refactor accomplishes 2 goals: Clean up the code, and speed it up greatly.
The previous code intermingled two distinct code paths into one, making the logic of the
function extremely difficult to tease out. The logic to handle querying the device
extensions of layers has always been in its own if block, but the logic to handle when the
app queries for the pPropertiesCount and the logic to fill out pProperties were intermingled.
The difficulty of terminator_EnumerateDeviceExtensionProperties is that it has to make sure
to provide the exact count of extensions whenever there are active implicit layers which add
extensions to the overall list. This is because apps do not expect the first call to return
a number larger than the real count.
The speedup mainly comes two changes:
* Only extensions from layers are de-duplicated - assume the driver list is already free of
duplicates, as our search is a brute force linear search of all extensions in the list.
* Do not allocate memory when filling out pProperties - when the app calls this function the
second time, we do not need any extra memory to perform the logic required.
Charles Giessen [Wed, 15 Mar 2023 23:58:46 +0000 (17:58 -0600)]
Enhance vkEnumerateDeviceExtensionProperties tests
Adds cases for duplicate extensions between layers and drivers, apps querying without enough
space or way too much space, null parameters, single-call, and more.
Charles Giessen [Wed, 15 Mar 2023 23:56:36 +0000 (17:56 -0600)]
Make tests throw if ASSERT failed
This makes the googletest assertions emit an exception whenever an assertion fails. This
prevents tests from continuing after some critical state has been violated. This is
advantageous because it is very easy to forget to put ASSERT_NO_FATAL_FAILURE around every
function which could trigger an error.
Charles Giessen [Wed, 15 Mar 2023 23:55:25 +0000 (17:55 -0600)]
Simple cleanup of loader_add_to_ext_list
Make variable definition be in their first use, not at the top of the function.
Charles Giessen [Thu, 16 Mar 2023 19:39:02 +0000 (13:39 -0600)]
Add missing backtick in LoaderInterfaceArchitecture.md
MeeSong [Tue, 14 Mar 2023 07:50:59 +0000 (15:50 +0800)]
Docs: Add missing ".md"
Mike Schuchardt [Mon, 13 Mar 2023 17:43:05 +0000 (10:43 -0700)]
build: Update to header 1.3.243
- Update known-good
- Generate source
- Add new return code to test_util.h
Charles Giessen [Thu, 9 Mar 2023 19:27:25 +0000 (12:27 -0700)]
Make check_code_format.sh not care about includes
The code being removed here was a fix for travis CI which is no longer in
use. The git diff ignores files in the gitignore, so this workaround is no
longer necessary.
Charles Giessen [Thu, 9 Mar 2023 19:25:55 +0000 (12:25 -0700)]
Add clang-format-diff.py
Turns out this script was never checked in, causing the check_code_format.sh script to
never run. This is due to python *not* returning an error when it fails to find the
python script, which results in the shell script passing while never actually checking
the formatting.
Charles Giessen [Thu, 9 Mar 2023 17:39:04 +0000 (10:39 -0700)]
Set github actions to only have read only permissions
Because the loader only uses github actions to perform CI runs, it is good to set
the 'read-all' only, helping harden the github actions runners from potentially
compromised access.
For more context
https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions
Fixes #1148
Charles Giessen [Tue, 7 Mar 2023 22:14:43 +0000 (15:14 -0700)]
Allow the loader to enable ASAN outside of testing
This commit promotes the build option TEST_USE_ADDRESS_SANITIZER and
TEST_USE_THREAD_SANITIZER to not be behind BUILD_TESTS. This allows users
of the loader to enable ASAN & TSAN support on the loader without enabling
the loader's tests.
The new options are called LOADER_ENABLE_ADDRESS_SANITIZER and
LOADER_ENABLE_THREAD_SANITIZER.
There is also a new build option: `LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING`.
This is to allow layers & drivers that use Address Sanitizer to get useful
stack traces when running their code. Because vkDestroyInstance unloads all
layer and driver dynamic libraries, leak sanitizer cannot create complete
stack traces, making debugging the leaks much more difficult than necessary.
This option is only available when LOADER_ENABLE_ADDRESS_SANITIZER is also
enabled, due to that being the only reason to prevent the unloading of
libraries.
Charles Giessen [Sat, 25 Feb 2023 01:09:47 +0000 (18:09 -0700)]
Call DestroyInstance on each driver in error path
If CreateInstance successfully calls terminator_CreateInstance but subsequently fails on the way
back up the chain, the loader should call DestroyInstance on each driver to give them a chance to
clean up. This path is possible during CTS OOM tests which cause VVL to fail which then causes
leaks to occur.
Additionally, the layer name allocations needed to be cleaned up in this error
path as well, since there is no chance for vkDestroyInstance to run.
Mike Schuchardt [Mon, 27 Feb 2023 18:47:21 +0000 (10:47 -0800)]
build: Update to header 1.3.242
- Update known-good
- Generate source
Mike Schuchardt [Thu, 16 Feb 2023 16:10:20 +0000 (08:10 -0800)]
build: Update to header 1.3.241
- Update known-good
- Use new 'depends' attribute for extension dependencies
- Generate source
Charles Giessen [Fri, 17 Feb 2023 21:25:12 +0000 (14:25 -0700)]
Fix documentation to use the correct function name
`vk_icdNegotiateLoaderICDInterfaceVersion` was intended but due to a copy paste error `vk_icdGetInstanceProcAddr`
was used instead.
Christophe [Mon, 13 Feb 2023 15:37:59 +0000 (16:37 +0100)]
Only allocate layers if initialization succeed
Christophe [Mon, 13 Feb 2023 14:47:55 +0000 (15:47 +0100)]
A bit more safe string copy
Christophe [Mon, 13 Feb 2023 14:34:50 +0000 (15:34 +0100)]
Use calloc instead of alloc
Christophe [Wed, 1 Feb 2023 17:40:42 +0000 (18:40 +0100)]
gni
Christophe [Wed, 1 Feb 2023 17:34:17 +0000 (18:34 +0100)]
Testing C.I. memory leak hypothesis
Christophe [Tue, 3 Jan 2023 15:37:15 +0000 (16:37 +0100)]
Warn user when using device layers field #1086
The device layer fields in VkDeviceCreateInfo are deprecated and have
been for years. Users should not be adding anything to them (and if
they do, it should match the layers added in VkInstanceCreateInfo).
This would be a warning that 'device layers are deprecated, they do
nothing' in case a user is trying to enable validation layers using
them. Charles has seen multiple users not knowing that they are
deprecated and get burned by the API due to not having validation
layers enabled.
Since there may be applications in the wild which currently do provide
a list of layers to device create info, this warning should only be
issued if the list differs from instance creation. That way no spurious
warnings are created.
Juan Ramos [Mon, 13 Feb 2023 23:10:35 +0000 (16:10 -0700)]
cmake: Add VULKAN_LOADER_VERSION
Juan Ramos [Mon, 13 Feb 2023 17:49:30 +0000 (10:49 -0700)]
cmake: Remove custom find_package code
Juan Ramos [Mon, 13 Feb 2023 17:48:22 +0000 (10:48 -0700)]
cmake: Use PkgConfig to find XCB, X11, and DirectFB
Juan Ramos [Wed, 1 Feb 2023 16:28:24 +0000 (09:28 -0700)]
ci: Test CMake min for Linux builds
Juan Ramos [Wed, 1 Feb 2023 00:27:25 +0000 (17:27 -0700)]
cmake: Remove pointless conditionals
CMake min is now 3.17
Ludovico de Nittis [Tue, 31 Jan 2023 14:58:48 +0000 (15:58 +0100)]
Clarify the VK_LOADER_DRIVERS_SELECT example
In the documentation examples, if we set
`VK_LOADER_DRIVERS_SELECT=nvidia`, we are saying to the loader to select
only the driver whose JSON manifest is called exactly `nvidia`.
This is likely not what we want, because the Nvidia drivers are usually
called something like `nvidia_icd.json`, and not just `nvidia` without a
file extension.
In the "Behavior" column it already states that:
"Since drivers don’t have a name like layers, this glob is used to
compare against the manifest filename."
So, to avoid confusion, we just need to change the example to reflect
how the loader glob works.
This commit also adds an additional automated test to ensure that this
full-name string glob actually works as described in the documentation.
Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
Charles Giessen [Tue, 10 Jan 2023 00:59:40 +0000 (17:59 -0700)]
Ensure VkPhysicalDevice unwrapping in Device functions
Certain functions, like vkSetDebugUtilsObjectNameEXT can take a physical device
as a parameter. When this function is queried through vkGetInstanceProcAddr,
the trampoline is returned, whereas when queried through vkGetDeviceProcAddr,
the trampoline wasn't returned, allowing the physical device parameter to not
get unwrapped before calling down the chain, causing a crash.
This commit modifies the codegen to always use the trampoline for these
functions, and adds tests for them. These changes require the the loader check
that the appropriate extensions are enabled during the application's call to
vkGetDeviceProcAddr, since it otherwise always return a non-null function
pointer.
Charles Giessen [Wed, 4 Jan 2023 22:05:02 +0000 (15:05 -0700)]
Implement VK_LUNARG_direct_driver_loading
VK_LUNARG_direct_driver_loading is an instance extension which allows
applictations to include drivers directly to the loader, instead of relying
on system installed drivers or environment variables specifying where the
desired driver is located. This allows applications to 'ship' a driver with
themselves and easily provide it to the system loader.
Changes related to direct driver loading:
* Source implementation
* Documentation of new extension, interactions with existing driver discovery
mechanism, and issues with implicit layers
* Extensive tests covering many feature combinations.
Changes also made in this commit:
* Add EnvVarWrapper which more cleanly handles setting, modifying, and
removing Environment Variables. This has the effect of allowing all tests to
run from the test executable without leaking env-vars, which previously
caused spurious test failure. Note - CTest runs each test in a separate
process which hides this issue.
* Adds -Wshadow=local for the gcc compiler (only for gcc 7 and up).
The MSVC compiler already enables this check with W4 so it was added for consistency.
* Add <!-- omit from toc --> to Documenation pages. This prevents the
"Markdown all in one" extension from adding labels to the table of contents.
* Add ManifestDiscoveryType::null_dir, to separate tests that want to write
a manifest file to a place the loader normally does not search and tests which
do not write any manifest file at all.
* Updated copyright to 2023 for changed files
Charles Giessen [Mon, 30 Jan 2023 19:22:08 +0000 (12:22 -0700)]
Remove newlines in log messages
The loader_log() function adds a new line at the end of every log message.
Having the string contain an extra new line is redundant and makes the output
inconsistent due to having random blank lines.
Mike Schuchardt [Mon, 30 Jan 2023 18:13:35 +0000 (10:13 -0800)]
gn: Add ninja to DEPS
Instead of relying on the version in depot_tools
Juan Ramos [Fri, 27 Jan 2023 22:44:47 +0000 (15:44 -0700)]
cmake: Remove custom install code
Juan Ramos [Fri, 27 Jan 2023 22:42:49 +0000 (15:42 -0700)]
cmake: Cleanup BUILD_TESTS code
Juan Ramos [Fri, 27 Jan 2023 22:39:52 +0000 (15:39 -0700)]
cmake: Add scripts/CMakeLists.txt
- Abstracts update_deps code similar to VVL
- Reduce(s) variable polution
Juan Ramos [Fri, 27 Jan 2023 16:34:33 +0000 (09:34 -0700)]
ci: Fix GitHub warnigs about setup-python@v2
Juan Ramos [Fri, 27 Jan 2023 16:48:34 +0000 (09:48 -0700)]
cmake: Update minimum to 3.17.2
Matches what VVL currently uses
Mike Schuchardt [Fri, 27 Jan 2023 17:38:34 +0000 (09:38 -0800)]
ci: Update GN toolchain
Mike Schuchardt [Fri, 27 Jan 2023 17:27:22 +0000 (09:27 -0800)]
build: Update to header 1.3.240
- Update known-good
- Generate source
Charles Giessen [Thu, 26 Jan 2023 22:11:25 +0000 (15:11 -0700)]
Re-checking loader.rc file
The loader.rc file is now checked into the source, and is automatically updated
by python whenever the headers are updated so that it contains the version used
to build the loader.
If BUILD_DLL_VERSIONINFO is set in the command line, then the loader will use
that version to configure a new loader.rc and place it in the build directory.
Then it will use that loader.rc rather than the checked in file. This allows
Vulkan Runtimes to be built with an exact version.
The file is checked in to allow builds without modifying the source directory
and allowing GN builds to not need any additional configuration to work.
Juan Ramos [Thu, 26 Jan 2023 23:47:59 +0000 (16:47 -0700)]
ci: Fix CI warnings
Charles Giessen [Wed, 25 Jan 2023 21:32:41 +0000 (14:32 -0700)]
Fix copyright in windows .rc file
This commit makes the copyright date to be taken from the day of the build
instead of it being hardcoded, which is liable to be out of date.
This commit also makes the loader.rc be generated into the build directory
rather than the source tree. Because this commit modifies the version info to
include the current header version for debug builds, this prevents needing to
update the file whenever the headers update.
Charles Giessen [Tue, 24 Jan 2023 17:52:24 +0000 (10:52 -0700)]
Log when VK_LAYER_PATH is ignored
The current design of the loader make the Override Layer, with its override
paths, take priority over VK_LAYER_PATH. This is fine, but if the override
layer accidentally was left around, it can cause confusion as VK_LAYER_PATH
suddenly stops working for no apparent reason. This commit adds a log message
to indicate that it is being ignored.
Juan Ramos [Mon, 23 Jan 2023 18:01:28 +0000 (11:01 -0700)]
github: Use main instead of master
closes #1107
Juan Ramos [Thu, 19 Jan 2023 17:44:08 +0000 (10:44 -0700)]
docs: Notify users about upcoming master to main change
Mike Schuchardt [Thu, 19 Jan 2023 16:49:15 +0000 (09:49 -0700)]
build: Update to header 1.3.239
- Update known-good
- Generate source
Charles Giessen [Tue, 17 May 2022 15:51:24 +0000 (09:51 -0600)]
Add Vulkan Loader and Driver Interface Version 7
The changes made by Version 7 are as follows.
If a Driver supports any of the following functions,
they must be exposed by with vk_icdGetInstanceProcAddr:
* vk_icdNegotiateLoaderICDInterfaceVersion
* vk_icdGetPhysicalDeviceProcAddr
* vk_icdEnumerateAdapterPhysicalDevices (Windows only)
This makes it optional for a driver to export these functions. Drivers may still
export them for compatibility with older loaders.
Loader and Driver Interface Version 7 allows for drivers provided through the
VK_LUNARG_direct_driver_loading extension to support the entire Loader and Driver
Interface.
This commit makes many small fixes to the documentation. Main changes are adding
Version 7 of the Loader and Driver Interface, clarifies when the functions
associated with this version must be exported, when they can be optionally exported
and when they must be exposed through vk_icdGetInstanceProcAddr. This also
clarifies LDP_DRIVER_10 to note the exact behavior of drivers that is disallowed.
In the process of these documentation changes, the glossary was amended with
definitions for Exported Functions, Exposed Functions, and Querying Functions.
Juan Ramos [Mon, 16 Jan 2023 21:33:39 +0000 (14:33 -0700)]
build: Remove VS2015 support
Juan Ramos [Mon, 16 Jan 2023 19:43:24 +0000 (12:43 -0700)]
ci: Test CMake minimum
Charles Giessen [Mon, 16 Jan 2023 05:32:01 +0000 (22:32 -0700)]
Add guard for GetPhysDevProcAddr typedef
vk_layer_dispatch_table.h may be included after vk_icd.h and may cause multiple
definitions. This commit adds a macro guard on whether the type is defined just
in case.
Charles Giessen [Thu, 8 Dec 2022 00:15:22 +0000 (17:15 -0700)]
Try to catch OOM errors when loading binaries
If there is an error loading a dynamic library, check to see if it is
the result of an OOM condition. Then return the appropriate OOM error
code up the callchain. This commit is the result of an OOM condition
when trying to load the validation layers, which resulted in the return
code VK_ERROR_LAYER_NOT_PRESENT. This is very misleading. If the
loader can catch then report more accurate information, then it should.
B Marques [Mon, 26 Dec 2022 17:57:02 +0000 (14:57 -0300)]
Added target condition to vulkan headers
Juan Ramos [Tue, 10 Jan 2023 16:57:35 +0000 (09:57 -0700)]
cmake: Fix usage of Vulkan::Registry
Vulkan::Registry was deprecated by Vulkan-Headers
Use 'VULKAN_HEADERS_REGISTRY_DIRECTORY' instead.
closes #1106
Charles Giessen [Tue, 6 Dec 2022 21:13:18 +0000 (14:13 -0700)]
Document behavior change in how bundles drivers are used
Document that a bundled driver on macOS will cause the loader to ignore drivers
in system installed locations.