-
ce0417de
by Charles Giessen at 2023-03-20T09:35:26-06:00
Simple cleanup of loader_add_to_ext_list
Make variable definition be in their first use, not at the top of the function.
-
286831b7
by Charles Giessen at 2023-03-20T09:35:26-06:00
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.
-
a1d42f32
by Charles Giessen at 2023-03-20T09:35:26-06:00
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.
-
889e6b72
by Charles Giessen at 2023-03-20T09:35:26-06:00
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.
-
23c3a604
by Mike Schuchardt at 2023-03-22T09:38:04-07:00
build: Update to header 1.3.244
- Update known-good
- Generate source
-
d7247630
by Mike Schuchardt at 2023-03-24T11:26:27-07:00
build: Update to header 1.3.245
- Update known-good
- Generate source
-
5bc74b04
by Charles Giessen at 2023-03-29T15:56:35-06:00
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.
-
9f30d582
by Mike Schuchardt at 2023-03-31T10:08:20-06:00
build: Update to header 1.3.246
- Update known-good
- Generate source
-
c3eb97de
by Charles Giessen at 2023-03-31T16:22:06-06:00
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)
-
50df6bc5
by Charles Giessen at 2023-04-05T23:42:21-06:00
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
-
8c8619df
by Charles Giessen at 2023-04-06T15:45:27-06:00
Use Ubuntu 22 in github actions
Remove the unneded pkg-config-i686-linux-gnu package since its gone in 22.
-
797ffe01
by Mike Schuchardt at 2023-04-13T11:39:04-07:00
build: Update to header 1.3.247
- Update known-good
- Generate source
-
55a3cf26
by Charles Giessen at 2023-04-17T13:43:20-06:00
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.
-
9f5ae790
by Charles Giessen at 2023-04-18T14:06:53-06:00
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.
-
4599ce27
by Charles Giessen at 2023-04-18T14:57:03-06:00
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.
-
f035e57c
by Charles Giessen at 2023-04-18T15:34:02-06:00
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
-
4be91725
by Charles Giessen at 2023-04-20T13:28:35-06:00
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.
-
07d1854c
by Mike Schuchardt at 2023-04-21T09:36:19-07:00
build: Update to header 1.3.248
- Update known-good
- Generate source
-
23d4caea
by Charles Giessen at 2023-04-25T07:57:40-06:00
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.
-
d23cf68c
by Charles Giessen at 2023-04-25T07:57:40-06:00
Add tests to preserve buggy query of vkCreateDevice
Insure that this bug is properly preserved and not accidentally fixed.
-
648b45a4
by Cathal Corbett at 2023-04-26T14:59:23-06:00
Update loader cmake lists to use PROJECT_SOURCE_DIR over CMAKE_SOURCE_DIR.
Change-Id: I5c9c62772182f401833db9dd9b9471a5b177d630
-
71254bed
by Mike Schuchardt at 2023-04-27T10:24:26-07:00
build: Update to header 1.3.249
- Update known-good
- Generate source
-
ab6f4023
by juan-lunarg at 2023-05-03T15:09:21-06:00
loader: Add win32 support for DYNAMIC_LIBRARY_UNLOADING
-
966ec44f
by Mike Schuchardt at 2023-05-04T11:55:44-07:00
build: Update to header 1.3.250
- Update known-good
- Generate source
-
22f10ad7
by juan-lunarg at 2023-05-04T15:29:50-06:00
docs: Update README.md
-
16cb31dc
by juan-lunarg at 2023-05-05T17:50:11-06:00
ci: Add concurrency functionality
-
7e5f590b
by juan-lunarg at 2023-05-05T17:50:11-06:00
cmake: Cleanup unicode logic
-
bdf499b2
by juan-lunarg at 2023-05-05T17:50:11-06:00
scripts: Incorporate latest changes from VVL
Improves build performance.
Fixes bug preventing Ninja on Windows usage.
-
a6f06c09
by juan-lunarg at 2023-05-05T17:50:11-06:00
ci: Test Ninja build
-
e7bf1536
by juan-lunarg at 2023-05-08T10:02:40-06:00
Fix LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING WIN32 support
-
a050f6e2
by juan-lunarg at 2023-05-08T15:08:45-06:00
ci: Test LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING
-
6c787b7f
by juan-lunarg at 2023-05-08T15:08:45-06:00
cmake: Fix LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING
-
04b6aa4a
by Charles Giessen at 2023-05-16T16:20:12-06:00
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.
-
823209c8
by Geoff Lang at 2023-05-16T16:37:41-06:00
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.
-
5a5c3e6f
by Charles Giessen at 2023-05-18T17:01:38-06:00
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.
-
35b005a5
by Charles Giessen at 2023-05-18T17:01:38-06:00
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.
-
7578ebfb
by Charles Giessen at 2023-05-22T12:17:19-06:00
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`
-
f001248f
by Charles Giessen at 2023-05-22T12:17:19-06:00
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.
-
b95d065e
by Charles Giessen at 2023-05-22T12:17:19-06:00
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.
-
14338951
by juan-lunarg at 2023-05-26T12:26:18-06:00
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.
-
eaf52a41
by juan-lunarg at 2023-05-29T12:18:40-06:00
docs: Document LOADER_CODEGEN
-
121c1f42
by juan-lunarg at 2023-05-29T12:18:40-06:00
cmake: Add LOADER_CODEGEN
-
c9ec0a4e
by juan-lunarg at 2023-05-29T14:38:13-06:00
cmake: Don't install GTEST along with vulkan loader
-
4290cc05
by juan-lunarg at 2023-05-29T14:38:13-06:00
ci: Test pkg-config and installation
closes #1204
-
8901c45a
by Charles Giessen at 2023-05-29T17:45:08-06:00
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.
-
de58ce28
by Charles Giessen at 2023-05-29T17:45:08-06:00
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.
-
882f79fe
by Charles Giessen at 2023-05-29T17:45:08-06:00
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.
-
bca23b3f
by Charles Giessen at 2023-05-29T17:45:08-06:00
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.
-
530a86cc
by Charles Giessen at 2023-05-29T17:45:08-06:00
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.
-
f94b5f48
by Charles Giessen at 2023-05-29T17:45:08-06:00
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.
-
6ff96f5b
by Charles Giessen at 2023-05-29T17:45:08-06:00
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.
-
d86db83c
by Charles Giessen at 2023-05-29T17:45:08-06:00
Make EnvVarWrapper remove env-vars initially
When an EnvVarWrapper object is created, it will now remove the env-var instead
of leaving the value unset (in the case of no initial value being given). This
is preferrable because it prevents external state from creeping in accidentally
if the test forgot to provide a value.
-
17664143
by Charles Giessen at 2023-05-29T17:45:08-06:00
Add GetActiveLayers function helper in tests
GetActiveLayers call vkEnumerateDeviceLayerProperties - which the loader treats
as the list of active layers. This helper function cleans up a lot of tests by
moving the exact same logic repeated many dozens of times into a single
location.
This commit also moves the EnumerateDeviceExtensions into the InstWrapper as a
helper, and updated its interface to require the requested extension count.
-
f63a610d
by Charles Giessen at 2023-05-29T17:45:08-06:00
Cleanup JSON output in tests with utility
Got tired of writing manual json output code, and moved the necessary
formatting logic into an easy to use utility. Makes the code MUCH cleaner and
easier to follow. Plus, it is now trivial to create JSON files so it will be
much easier to test the loader's parsing code.
-
7990f7f0
by Charles Giessen at 2023-05-29T17:45:08-06:00
Add unsecured manifest location to tests
Meta layer should not be loaded if it originated from an unsecured location.
This commit contains the necessary changes needed to test layers & drivers that
live in the user local directory on linux and HKEY_CURRENT_USER on windows.
-
049d0828
by Charles Giessen at 2023-05-29T17:45:08-06:00
Add test utilities for getting instance layers and extensions
Since it is incredibly common for tests to query the instance layers and
extensions, add helper functions to ease the enumeration of them and place the
results into an output vector, as well as check that the expected count is
equalt to the real count.
The GetActiveLayers function which did not take an expected count was removed
as tests should always know the exact number of layers that are present.
ASSERT_NO_FATAL_FAILURE was added to anyplace that queried extensions or layers
but requested a count of 0. This was done to insure that future maintainers do
not remove the seemingly redudant query of 0, as it is very much a part of the
test code since there are EXPECT macros inside the respective enumeration
utility functions.
-
551c212f
by Charles Giessen at 2023-05-29T17:45:08-06:00
Make Allocation tests less noisy
The allocation tests will flood the output, change the debug log to only
issue error and warning level messages.
-
2bb8117b
by Charles Giessen at 2023-05-29T17:45:08-06:00
Include Hive in windows registry logs
Which hive is being queried is useful information to have, this commit adds the
HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE hive strings to the appropriate log
messages.
-
05580ac9
by Charles Giessen at 2023-05-29T17:45:08-06:00
Fix log.h to use #pragma once
Also only include whats absolutely necessary and forward declare the rest.
-
bead4f48
by Charles Giessen at 2023-05-29T17:45:08-06:00
Move library list allocation to out of layer search function
The allocation of the library list shouldn't be happening in the call to
loader_scan_for_implicit_layers.
-
0fea29c4
by Charles Giessen at 2023-05-29T17:45:08-06:00
Pass inst rather than NULL during layer scanning
This commit fixes a bug in loader_scan_for_layers where the getting of filter
environment variables used NULL rather than the already available inst handle.
-
cd82b5f9
by Charles Giessen at 2023-05-29T17:45:08-06:00
Remove redundant variable in loader_scan_for_layers
total_count would only ever be non-zero if manifest_files.count is non zero, thus
it doesn't ever impact the control flow used.
-
f10010c2
by Charles Giessen at 2023-05-29T17:45:08-06:00
Remove useless if check in loader_scan_for_layers
The for loop will automatically skip the logic if manifest_files.count is zero.
-
f7fd5781
by Charles Giessen at 2023-05-29T17:45:08-06:00
Remove useless lock & comment out cJSON error handling
Because the error handling mechanism used a static variable, that meant that to
use cJSON_GetErrorPtr required a lock. This error function was never used, meaning
the lock that was there wasn't guarding any resource. cJSON doesn't have any non
const static variables.
This commit removes the lock and any associated code, which was improperly handled
in loader_scan_for_layers anyhow (potentially unlocking an already unlocked mutex).
-
c145941e
by Charles Giessen at 2023-05-29T17:45:08-06:00
Remove redundant clear when scanning for layers
All callers of loader_scan_for_implicit_layers and loader_scan_for_layers
clear out instance_layers before calling, making the call to
loader_delete_layer_list_and_properties redundant.
Also reordered the local variable declaration order to match.
-
fe73c418
by Charles Giessen at 2023-05-29T17:45:08-06:00
Significantly reduce duplicate layer scanning code
The layer scan functions had a pattern of calling loader_get_data_files,
parse the json found, and put the resulting parsed loader_layer_properties
into the output instance_layers list. This pattern was done twice in each
layer scan function, so in total 4 times. Thus, it was ripe for pulling the
common code into a new function, loader_parse_instance_layers().
The one bit of logic not shared between the two paths is whether or not the
layers being scanned are implicit or explicit. This is made easy by the fact
that the manifest_type dictates whether to parse the scanned manifests as
implicit or explicit layers.
Also, the code to get the override path was identical - but was copy pasted.
Moving it into a separate function cleans up the functions quite
siginificantly.
-
385fe46c
by Charles Giessen at 2023-05-29T17:45:08-06:00
Fix tests dying if an exception is thrown.
The test framework will generate an exception if any googletest assertion fails.
However, if there already is an ongoing exception, we do not want to throw
another one. Thus, we check if std::current_exception() is nullptr, and only
throw our own exception if it is nullptr.
-
029732a3
by Charles Giessen at 2023-05-29T17:45:08-06:00
Add tests for system installed binaries
When library_path in a manifest doesn't contain any directory separators, it
signals to the loader that the library name should be passed directly to
dlopen/LoadLibrary and for those functions to use the dynamic linkers default
search paths. This commit adds tests that do that, as well as sets up the
required functionality to implement this behavior in the test framework. For
Unix systems, this involves redirecting dlopen so that it loads the correct
binary - rather than relying on dlopen to find it for us. For Windows, we
use AddDllDirectory to modify LoadLibrary's search path as well as
SetDefaultDllDirectory to change LoadLibrary's behavior to do what we want.
-
1fb962c2
by Charles Giessen at 2023-05-29T17:45:08-06:00
Remove DEFAULT_VK_DRIVERS_PATH macro define
DEFAULT_VK_DRIVERS_PATH was undocumented and a compile time build - so anyone
using it would need to rebuild. VK_DRIVER_FILES and VK_ICD_FILENAMES are
environment variables which serve the same purpose without the need to recompile.
-
958c0fa0
by Charles Giessen at 2023-05-29T17:45:08-06:00
Remove layer list copies from loader_device
The layer lists do not need to be separate from the instance - as layers that
are active on a device must also be active on the instance. This saves unecessary
storage and allocations.
The concern of being able to create devices in multiple threads is alleviated
because device creation is a read-only process, so there is no contention. As
well as the instance must be valid (not destroyed) so that means the layer data
must also be available.
-
180b1c3e
by Charles Giessen at 2023-05-29T17:45:08-06:00
Meta layers now dont add layers more than once
The check to make sure a layer isn't being added more than once was not present
for component layers of meta layers. Now, component layers from meta layers are
only added if they haven't been added before.
-
a6c76b16
by Charles Giessen at 2023-05-29T17:45:08-06:00
Turn layer lists into lists of pointers
The expanded_activated_layer_list and app_activated_layer_list now are lists of
pointers to the instance_layer_list of actual layers. This change was done to
remove the very large copies done to store the various layer lists.
This commit introduces a new type, loader_pointer_layer_list, which is a simple
list like structure for holding the pointers to the loader_layer_properties.
This commit moves the responsibility of unloading layers from
expanded_activated_layer_list to the instance_layer_list, meaning that closing of
libraries is now done during the calls to loader_delete_layer_list_and_properties.
loader_delete_layer_list_and_properties is also now called after the return from
vkDestroyInstance, since layer libraries need to stay alive until after they get a
chance to clean themselves up.
loader_add_layer_properties_to_list was modified to only ever add one layer at a
time, since all uses of it did this and it makes the definition easier to follow.
-
caf8afb4
by Charles Giessen at 2023-05-29T17:45:08-06:00
Refactor to not use fixed length strings
Many places in the loader stored paths in fixed length strings. This has
two major downsides, firstly that the loader could not support paths greater
than 1024 characters, and secondly that it greatly increased the memory
overhead needed for an instance. The memory pressure was something in the
order of 100kb+, most of which was completely empty strings.
To facilitate this change, the loader_layer_list type was added along with
several utility functions to create string lists, destroy string lists,
add elements to a string list, etc. The liberal use of the new type allows
for a lot of duplicate code to be deleted - as much of the layer parsing
logic was just to manage the various arrays of strings.
The loader_layer_properties struct now contains many char*'s and
loader_string_lists, and owns any of the strings inside of it. Compared to
before the commit, the loader_layer_properties struct is a mere 700 bytes
large versus the 11kb it was before.
loader_data_files is just a list of strings, so was replaced with the new
loader_string_list type, along with removal of any custom functions that
created/destroyed it.
One downside of the change is that various places in the loader used the
fact that a string was never NULL to not need to do a nullptr check. Because
many strings were just char arrays with a value of 0 throughout, the logic
was not needed. Switching to char*'s required adding NULL checks in various
places, such as loader_getenv and loader_secure_getenv.
The combine_manifest_directory_and_library_path function is the most
complex change in the entire commit. It implements behavior that was
duplicated between two separate places (layer and driver loading). The previous
logic also used dirname(), which required creating a new string to use. The
new function implements the behavior of dirname without the extra string.
It also will reuse a passed in string if appropriate - removing another
potential string copy.
loader_read_layer_json was refactored to be much easier to follow as well as
using the various json parsing utility functions that make it easy to get
strings, lists of strings, etc. The refactor changed the logic to only add
the loader_layer_properties structure to the list if it is successfully parsed,
rather than having to remove the properties if it fails in any way. Also the
macros were removed since they decreased readibility for marginal deduplication.
Before this commit, cJSON_Print was called many times in loader_read_layer_json,
which returns a newly allocated string, only for the data to be copied out of
it into a char array, then immediately freeing the allocated string. Now, those
allocations are put into the properties struct, saving a stack alloc & memcpy
per string.
-
1e1c3523
by Charles Giessen at 2023-05-29T17:45:08-06:00
Fix cJSON_print using wrong allocation scope
Because cJSON_print uses cJSON_malloc, it meant that all calls to cJSON_print
used the command allocation scope. With the change to directly store the strings
returned by cJSON, this meant that various strings were being stored in the
instance that were not allocated with the instance scope. This fixes that.
This commit also adds a safeguard to ensure the cJSON object is cleaned up if
loader_get_json fails
-
eae56594
by Charles Giessen at 2023-05-29T17:45:08-06:00
Remove guard for C++ in cJSON.h
The cJSON.h library is only used by C code, so the macro guard for C++ is not
needed.
-
b6bdf4d0
by Charles Giessen at 2023-05-29T17:45:08-06:00
Use braces consistently in new helper functions
-
948d193e
by Charles Giessen at 2023-05-29T17:45:08-06:00
Add header files to source file list in CMake
Gives a better experience for Visual Studio and XCode developers.
-
2e5b5f87
by Charles Giessen at 2023-05-29T17:45:08-06:00
Modify test framework surface creation helpers
The surface creation helper functions were overloaded with a function that
only needs the VulkanFunctions* and VkInstance paramters, which allows them
to be used in the Out Of Memory allocation callback tests. To facilitate this
change, the return value of create_surface was changed to a straight VkResult,
requiring calling code to check that the result value is what they expect.
-
9a7de469
by Charles Giessen at 2023-05-29T17:45:08-06:00
Add loader settings file
The loader settings file is a json file that enables external tools, such as
VkConfig to precisely enable and order the layers. This mirrors the
functionality of the override meta layer but by not being a layer, is able to
be much more cleanly implemented.
The primary capability of the settings file is to be able to dictate the
order of all layers regardless of their type. If the loader detects a settings
file, it will use the order provided in it. It has similar functionality for
applying a setting per-application as well as globally. A new feature is the
ability to dictate the 'global' logging behavior, eg overriding the
VK_LOADER_DEBUG environment variable.
Settings are per-instance, so if an application destroys its instance and
creates a new one, it will get the most up to date settings file. There is
a 'global' settings file used for pre-instance functions, and is updated on
every call that makes use of the settings (aka all global functions except for
vkGetInstanceProcAddr).
Most of the new code lives in settings.h and settings.c but changes were made
to loader_scan_for_layers, loader_scan_for_implicit_layers,
loader_enable_instance_layers, and loader_validate_instance_extensions.
-
876f2eb8
by Charles Giessen at 2023-05-29T17:45:08-06:00
Separate meta layer verification & update logic
verify_meta_layer_component_layers previously would update the extension lists
of valid meta layers, which possibly allocates memory. The function had no
way to report OOM so instead, the updating of extension lists was added to a
separate function that gets called for successfully verified meta layers. Now
that the updating is moved out, the function can be simplified to return
false if any check fails.
This commit also cleans up verify_all_meta_layers such that the OOM is
propagated upwards if necessary, including modifying any callers of that
function.
-
1ef96620
by Charles Giessen at 2023-05-29T17:45:08-06:00
Add NULL checks to cJSON helper functions
-
ec2e4a66
by Charles Giessen at 2023-05-29T17:45:08-06:00
Propagate OOM in more places
-
5e3cbc6f
by Charles Giessen at 2023-05-29T17:45:08-06:00
Use strncpy in loader_add_environment_layers
-
3382accd
by Charles Giessen at 2023-05-29T17:45:08-06:00
Fix issues found with clang-tidy
clang-tidy found numerous issues, roughly divided into three categories:
* Unused variables
* strcpy is unsafe
* NULL dereference due to missing NULL check
-
e82ce44a
by Charles Giessen at 2023-05-30T13:18:02-06:00
Remove foward declaration of VkResult and VkFlags
While it is nice to forward declare the 1 type needed, it is better to include
vulkan.h since the enum forward declaration is a microsoft specific extension.
-
4906126f
by Mike Schuchardt at 2023-05-30T21:21:57-06:00
build: Update to header 1.3.251
- Update known-good
- Generate source
-
fa5fb6f9
by Charles Giessen at 2023-05-30T21:22:08-06:00
Remove unused variable for clang-cl on windows
read_data_files_in_search_paths' `relative_path` is only used on unix
platforms but is defined for all platforms. This causes clang-cl to
warn about it, and causes the build to fail when ENABLE_WERROR is on.
The fix is to *not* define the offending variable on windows. Makes the
code more annoying to read due to the excessive #if #else macros, but
that is the simplest change.
-
1f20a308
by Charles Giessen at 2023-05-31T17:15:41-06:00
Add clang-cl run to github actions CI
Chromium builds use clang-cl so best to make sure we don't break them.
-
58627ec5
by Charles Giessen at 2023-06-01T19:05:56-06:00
Remove loader.aps
The aps file is a Visual Studio binary file that is a compiled version of
loader.rc used by resource editors. The documentation calls out that this
file should not be checked into source control, so it can be safely removed.
-
d3afd16e
by Charles Giessen at 2023-06-01T19:05:56-06:00
Make assembly work on macOS
The assembly for unknown function support did not need too many changes to
make it compile, link, and pass all tests on macOS.
The main change is working around the ABI of macOS, namely that C symbols have
an underscore prepended. To workaround this, the __asm("name") syntax was
used to make sure the symbols weren't modified. All of the declarations in
dev_ext_trampoline.c and phys_dev_ext.c need the
change, but so does loader_log because it gets called by the asm code.
Additionally, the .hidden attribute is only present for the ELF output. So
that has to be removed during compilation on macOS.
-
9ff7ab43
by John Bauman at 2023-06-02T13:20:33-06:00
loader: Add void to function arguments
UBSan was detecting a function type mismatch for these module
ctor/dtors since libc expects the function type to be void (*)(void)
rather than just void (*)().
-
8240d65b
by Charles Giessen at 2023-06-03T23:28:40-06:00
Remove inclusion of winsock2.h
The header is unused and causes compilation issues due to the header needing
to be included before windows.h
-
711626c2
by juan-lunarg at 2023-06-05T13:44:46-06:00
ci: Add MinGW build
-
297d65cf
by Charles Giessen at 2023-06-07T11:40:44-06:00
Add CI runs for unknown function fallbacks
There is C code that is used when the ASM support for unknown function fails to build
or the ASM build is explicitly disabled. This previously had no tests for these code
paths. Now there is a Github actions run for each platform, such as linux, windows,
macOS, as well as 32 bit linux and mingw.
-
2f37ce76
by Charles Giessen at 2023-06-07T11:40:44-06:00
Fix fallback unknown function build logic
The build logic for enabling the unknown function support when ASM code doesn't
work or is disabled was broken. This fixes it by consolidating the various code
paths as well as making sure it is enabled when it should be.
This also fixes the fallback path for macOS by making sure to only modify the
names of functions if and only if the corresponding assembly code is active.
-
e3cda58b
by Charles Giessen at 2023-06-07T11:40:44-06:00
Silence MINGW error about casting functions
When compiling with MinGW, GCC emits a warning:
"error: cast between incompatible function types from 'FARPROC' to ..."
GCC doesn't like the cast after calls to GetProcAddress, so
casting to void* first fixes the warning.
-
17a0596c
by Charles Giessen at 2023-06-07T11:40:44-06:00
Disable MinGW Github Actions run
MinGW uses JWASM to compile the assembly code. This commit disables that run
for the time being because github actions currently doesn't have JWASM setup.
While work could be done to get it working, it is low priority.
-
f72e344c
by Charles Giessen at 2023-06-07T12:26:20-06:00
Change settings file location
Move the settings registry to "LoaderSettings" and the unix location
to "loader_settings.d".
The validation layers looks for the settings file on windows in
"SOFTWARE/Khronos/Vulkan/Settings" but doesn't check the file name.
To maintain compatibility, the loader's settings file needs to be
in a different location.
-
c97930ba
by Charles Giessen at 2023-06-07T13:01:01-06:00
Fix USE_MASM=OFF in github actions
The windows_vs-no-asm was incorrectly setup, causing the assembler to
be found when it should have used the fallback path.
-
ff99d273
by Mike Schuchardt at 2023-06-12T12:19:29-06:00
build: Update to header 1.3.253
- Update known-good
- Generate source
-
0d175b27
by Tony-LunarG at 2023-06-12T14:24:40-06:00
Better handle missing settings file
-
4f597518
by Charles Giessen at 2023-06-12T21:37:40-06:00
Replace strok with threadsafe versions
strtok is not threadsafe, which was previously not a problem thanks to the
'read json' mutex. But since that was removed, it left strtok potentially
corrupting data as multiple threads try to use it. The fix is to replace
strtok with platform specific threadsafe versions, namely strtok_s for
windows platforms and strtok_r for unix platforms.
-
338825a7
by Charles Giessen at 2023-06-12T21:37:40-06:00
Add tests for longer version strings
Include tests which exercise parsing logic for versions longer than
a single character.
-
88d70047
by Charles Giessen at 2023-06-12T21:37:40-06:00
Fix EnvVarWrapper overwriting values
When EnvVarWrapper gets created, it clobbers the existing value of the
environment variable if it exists. When running multiple tests in a row
inside of a single process, the values set by the loader_testing_main.cpp
should be what every test is initialized with. To make that happen,
EnvVarWrapper now will save the existing value if it exists, then re-apply
it during its destructor.
-
9f6660f4
by Charles Giessen at 2023-06-14T14:14:55-06:00
Simply usage of LOADER_STANDARD_C_PROPERTIES in cmake
LOADER_STANDARD_C_PROPERTIES and LOADER_STANDARD_CXX_PROPERTIES included
PROPERTIES, which made it difficult to compose with other properties.
Removing PROPERTIES and adding it to every use of LOADER_STANDARD_C_PROPERTIES
makes the cmake code easier to understand.
-
af431fbe
by Charles Giessen at 2023-06-14T14:14:55-06:00
Use CMAKE_MSVC_RUNTIME_LIBRARY to set desired C runtime for windows
CMake 3.15 added the capability to directly set the desired C runtime
used. The loader itself should use -MT, or multithreaded static, so
that it statically links in the C runtime into itself. The tests use -MD,
or multithreaded dynamic because they share allocations between the various
dll's and .exe boundaries.
The TESTS_STANDARD_CXX_PROPERTIES makes setting the MSVC_RUNTIME_LIBRARY
easier across the many various components that need it set.
-
676e5308
by Christopher Degawa at 2023-06-15T11:43:20-06:00
loader: fix 32-bit jwasm compilation
jwasm, and by extension uasm, requires setting a cpu model to at least
386 in order to set the model to flat.
References:
https://github.com/JWasm/JWasm/blob/7218960b65d69216693a655d928eb4c2fb6b505c/cpumodel.c#L330-L332
https://github.com/Terraspace/UASM/blob/bffb18461dd541479064990c3b2750ab50ae23e2/cpumodel.c#L326-L328
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
-
bcfb5020
by Charles Giessen at 2023-06-15T14:45:05-06:00
Mark thread_safe_strtok as inline
Because the function definition lives in a header, it needs to be marked inline
to prevent compiler warnings stating that "thread_safe_strtok is unused".
-
5dba6d2a
by Mike Schuchardt at 2023-06-16T11:34:40-07:00
build: Update to header 1.3.254
- Update known-good
- Generate source
-
f004eeed
by Charles Giessen at 2023-06-16T14:02:58-06:00
Add and fix warnings for unused functions and parameters
These warnings were disabled, and this commit enables them.
It also fixes the many warnings that were present but were silenced. This
includes many unused parameters that could be safely removed. But it also
required marking some parameters as `(void)param;` to indicate to the
compiler that the parameter is infact required. If a function is a stub
function, then instead all of the names of the parameters were removed.
The biggest change is for vk_dispatch_table_helper.h which had stubs for
every device function. Rather than try to mark every parameter as unused
it was simpler to remove all stub functions, which aren't useful for
testing anyhow. Tests should crash rather than silently continue anyhow.
-
db518859
by Charles Giessen at 2023-06-16T14:02:58-06:00
Add ENABLE_WERROR to github actions
Makes github actions fail if there are any warnings generated.
-
5139044b
by Charles Giessen at 2023-06-20T13:49:58-06:00
Cleanup BUILD.md
Removes a lot of unnecessary text, fixes a few places that still
referred to Vulkan-ValidationLayers, replaces usage of CMake
options in the form `-DOPTION=...` with `-D OPTION=...`, moves a
few blocks of text to be in a more sensible order, and adds a
brief description of the build requirements like needing a C99
compiler.
-
f7fc91ff
by Charles Giessen at 2023-06-20T13:49:58-06:00
Update tests to require a C++17 compiler
-
a490c86a
by Charles Giessen at 2023-06-20T13:49:58-06:00
Remove unnecessary constructors in tests
C++11 does not allow aggregate initialization for types with default values.
Thus, many structs used in the tests had to have constructors written which only
filled in values. With C++17, these constructors can be removed and aggregate
initialization used in many places.
This commit also provides default values for previously undefined structs to
prevent any bugs deriving from uninitialized data.
-
c9b87f85
by Charles Giessen at 2023-06-20T13:49:58-06:00
Use [[maybe_unused]] in tests
Many components of the test framework have functions where not all parameters
are used, necessitating marking the parameter as unused. Before C++17, this was
done with `(void)parameter;` syntax, but now can be done more cleanly.
-
a2f3d10f
by Charles Giessen at 2023-06-20T13:49:58-06:00
Refactor how tests enable WSI
Moved the various free functions to setup WSI on drivers &
instances to member functions.
-
89369101
by Charles Giessen at 2023-06-20T13:49:58-06:00
Remove tests PhysicalDevice constructor overload
Having constructors to initialize specific values doesn't make sense when
the struct itself has extensive setter functions for the value in question.
-
727d1436
by Charles Giessen at 2023-06-20T13:49:58-06:00
Add EnumerateLayerDeviceExtensions helper to tests
Removes code duplication by taking EnumerateDeviceExtensions and modifying
it to accept a layer parameter.
-
5ac893fa
by Charles Giessen at 2023-06-20T13:49:58-06:00
Refactor how tests load function pointers
The `load()` helper function exists so that tests dont need to
manually reinterpret_cast the returned value.
Also took liberty to change the names of function pointers which
come from extensions to include the extension in the name.
EX: AcquireDrmDisplay -> AcquireDrmDisplayEXT
-
9a047093
by Charles Giessen at 2023-06-20T13:49:58-06:00
Cleanup test creation of queues
This commit removes queue creation from many tests because they were not a
primary part of the test. Many tests are written by first copying a previous
test and modifying it, which meant that a handful of initial tests would
include queue creation logic then get copied into many other tests where it
does not make sense.
-
27e1acf1
by Charles Giessen at 2023-06-20T13:49:58-06:00
Refactor return value of env.add_icd()
Make it return the driver that was just added rather than the ICD that
holds the driver, allowing for more concise code. This is because most
tests which modify the driver in some fashion do it in one go, and by
using the builder pattern, can be done all in a single statement.
-
b02d69f3
by Juan Ramos at 2023-06-21T16:56:12-06:00
cmake: Update update_deps.py logic
-
243b64f8
by Charles Giessen at 2023-06-22T22:27:45-06:00
Clarify requirements for Layer Interface Version 1
The loader has never searched for `GetInstanceProcAddr` or `GetDeviceProcAddr`,
yet has documented that Layer Interface Version 1 supports layers that export
those functions.
-
da7778de
by Charles Giessen at 2023-06-22T22:27:45-06:00
Cleanup test layer GIPA & GDPA function exports
Splits apart the Version 0 layer into one with 'vkGetInstanceProcAddr'
and one with 'test_layerGetInstanceProcAddr' (with a similar change for
vkGetDeviceprocAddr). This is more in line with how layers in the wild
are written.
Removes the NO_PREFIX GIPA & GDPA exports as that is not supported by
the loader.
-
44211ff2
by Charles Giessen at 2023-06-22T22:27:45-06:00
Remove indexing on layer_prop_list
The usage of the layer property list inside of
loader_check_layer_list_for_phys_dev_ext_address was modified when the
list changed from an array of struct loader_layer_properties, to an array
of pointers to struct loader_layer_properties. Except, the usages of
layer_prop_list were not updated in kind, leading to out of bounds indexes
when searching for unknown physical device functions in layers. This causes
crashes in the validation layer tests, which make use of this functionality.
-
5525f023
by Charles Giessen at 2023-06-22T22:27:45-06:00
Add test for layer_prop_list out of bounds indexing
This test makes sure that we correctly query for unknown functions implemented
only in a single layer while there are other layers present. This commit
successfully reproduces the error that the previous commit fixes. It was
difficult to reproduce because to get an crash, the test has to have the
instance_layer_list be in a different order than how they appear in
expanded_activated_layer_list.
-
a1d9d485
by Mike Schuchardt at 2023-06-23T12:22:55-07:00
build: Update to header 1.3.255
- Update known-good
- Generate source
-
dce85674
by Mike Schuchardt at 2023-06-30T13:38:55-06:00
build: Update to header 1.3.256
- Update known-good
- Generate source
-
9d38cccf
by Pino Toscano at 2023-07-03T14:04:32-06:00
loader: add support for GNU/Hurd
* add the Hurd to COMMON_UNIX_PLATFORMS, as it is a POSIX OS
* use the Linux paths for getting the executable path (i.e. using
/proc/self/exe): the Linux procfs provides both "self" and
"<pid>/exe"
* follow the Linux behaviour in tests w.r.t. the platform shim
behaviour, the test dummy binaries, and few more other bits
-
8b94e87b
by Mike Schuchardt at 2023-07-10T10:45:24-07:00
build: Update to header 1.3.257
- Update known-good
- Generate source
-
6837a92c
by mylifeyouwill at 2023-07-14T10:49:33+02:00
Fix Condition Statement Error
-
1bb7cec7
by Joyce at 2023-07-18T10:07:25-06:00
Create SECURITY.md
Signed-off-by: Joyce <joycebrum@google.com>
-
a230ae63
by Charles Giessen at 2023-07-18T15:49:15-06:00
Fix duplicate layer test which used /etc
The ImplicitLayers.DuplicateLayers test requires there to be two separate
files on the file system, located in different paths. To accomplish that, the
test writes a file to /etc and another to the default location. By default,
that is typically /usr/local/share. If the project is configured to set /etc
as that default location, only one file will be written.
The fix is to move the duplicate file from /etc to the default home directory,
since that is configured from inside the tests itself. This does change the
order the layers are found in, so the logic of the test had to be flipped.
-
031b0ef9
by Charles Giessen at 2023-07-18T15:49:15-06:00
Fix wrong pointer usage
get_override_layer_override_paths logs the path used, but during the refactor it
failed to dereference the double pointer properly, leading to the loader_log
message reading garbage. This was not caught on x64 address sanitizer builds, but
was on the 32 bit build.
-
0fde6082
by Charles Giessen at 2023-07-18T15:49:15-06:00
Add test for override layer path logging
-
fdae336d
by Charles Giessen at 2023-07-18T15:49:15-06:00
Set SYSCONFDIR in linux-32 actions CI run
Ensures that this build setting is exercised.
-
bd7a217b
by Mike Schuchardt at 2023-07-21T10:03:07-07:00
build: Update to header 1.3.258
- Update known-good
- Generate source
-
4854d849
by Juan Ramos at 2023-07-21T16:34:21-06:00
cmake: Remove cmake-format
-
84b0aeec
by Mike Schuchardt at 2023-07-24T10:23:17-07:00
build: Update to header 1.3.259
- Update known-good
- Generate source
-
84b63d45
by Charles Giessen at 2023-07-24T12:07:44-06:00
Enhance warning messages for portability enumeration
There are three different ways for applications to fail to enumerate
portability drivers, not enabling the flag bit, not enabling the extension,
and both. These were all reported as the same error, which isn't as helpful
as it printing a separate message for each case.
This also makes it possible to emit a VUID for the case of setting the flag
bit but not the extension.
-
8c265825
by Charles Giessen at 2023-07-24T16:32:05-06:00
Warn when ICD Manifest version differs from vkEnumerateInstanceVersion
The apiVersion inside of the ICD Manifest is the first version the loader uses
to determine what the driver is capable of. If it is 1.1+, it will query for
vkEnumerateInstanceVersion & call it. This commit adds warnings for when the
returned version is 1.0 as well as when the function failed to be queried,
which a 1.1+ driver should not fail.
This warning is in response to a real issue due to behavioral differences in
the loader between 1.0 and 1.1 drivers, as the manifest file reported 1.1
while the vkEnumerateInstanceVersion reported 1.0.
-
6c0da7b1
by Charles Giessen at 2023-07-24T16:32:05-06:00
Add VK_LAYER to layer names in tests
Layer names should begin with VK_LAYER, which wasn't being done in certain
tests which this commit fixes.
-
b9bd696a
by Charles Giessen at 2023-07-24T16:32:05-06:00
Cleanup how tests create PhysicalDeviceGroup vectors
Makes use of the vectors initialization constructor to remove iterating over
the elements of the vector to set the sType manually.
Also zero's out the VkPhysicalDevice array in the TestICD so that non-filled
in elements have a value of zero instead of being uninitialized.
-
661037ec
by Charles Giessen at 2023-07-24T16:32:05-06:00
Remove unecessary version setting in tests
The default value is 1.0, so it isn't necessary to set it.
-
220a00bf
by Charles Giessen at 2023-07-24T16:32:05-06:00
Set correct API version in tests
The manifest file version and physical device properties versions should match
in many of the tests, to insure that there isn't unintended behavior occuring.
This commit also cleans up the LayerPhysDeviceMod tests so they aren't adding
an ICD at the very top, which appears to have been accidental. Making that fix
did require modifying the test logic to put physical devices in a slightly
different order in the physical device groups.
-
fc8116bb
by Charles Giessen at 2023-07-25T15:45:20-06:00
Check api version when querying device commands
Note: This behavior is not enabled at this time. Future work is needed
to determine when to enable the behavior described below
Device commands from versions newer than the apiVersion should not be used,
since the app did not enable support for them. But querying for the functions
ignored the API version. This commit makes the loader check the apiVersion
before deciding whether to return a valid function pointer or NULL.
Tests were added for verifying each behavior, however the tests are
only partially implemented as there is no mechanism to enable the behavior
at the current time.
-
706ac5bd
by Charles Giessen at 2023-07-27T14:22:36-06:00
Add tests for explicit layers with pre_instance_functions
Makes sure that any explicit layers with pre_instance_functions are
ignored, even if they would be enabled by an override layer or the
settings file.
-
bdc52977
by Charles Giessen at 2023-07-27T15:57:37-06:00
Make Disabling Dynamic Library unloading a runtime option
This behavior was previously only available if compiled with a specific
option, but its useful enough to be moved into a runtime option.
To enable the behavior, set the environment variable
VK_LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING to "1".
-
b93def1b
by Gregory Schlomoff at 2023-07-27T16:08:43-06:00
Fix wrong file name in comments
-
bf59b634
by Charles Giessen at 2023-07-28T12:06:13-06:00
Make fatal log messages be written to stderr
When the loader is about to call abort(), it calls loader_log to tell the user
why the loader is crashing. Unfortunately, unless the user set VK_LOADER_DEBUG
before starting the loader, they will not see this message. This commits adds
a new debug flag to signal to loader_log() that this message should be written
to stderr no matter what. This commit also changes all current loader_log call
sites that subsequently call abort() to use this flag.
-
1f78c0bd
by Charles Giessen at 2023-07-28T22:44:07-06:00
Add relative path support to test harness
Makes sure the loader test framework can create relative paths in
the library_path fields. Adds a test to insure those paths still
work.
Since the contents of "library_path" is mututally exclusive with
the existing use_dynamic_library_default_search_paths, a new enum
was added to allow tests to choose which of the three content
types a given ICD or Layer manifest should use.
-
280997da
by Charles Giessen at 2023-07-29T13:30:07-06:00
Fixed the value of the FATAL_ERROR bit
0x160 is *not* the next highest power of two in hex after 0x80, it is in fact 0x100.
This error caused the log function to always log every message, rather than just
fatal ones and whatever messages match the VK_LOADER_LOG environment variable.
-
f8610769
by Mike Schuchardt at 2023-07-31T13:11:12-07:00
build: Update to header 1.3.260
- Update known-good
- Generate source
-
faeb94c2
by Charles Giessen at 2023-07-31T14:18:05-06:00
Unwrap VkInstance in set name/tag debug functions
It is possible for a layer to wrap the instance handle, and when the various
Set Name/Tag debug functions are called, the passed structure may contain an
instance handle which was previously not being unwrapped before calling down
the chain. This caused renderdoc to crash, as the instance handle was not
known to it.
-
0ec23bb3
by Charles Giessen at 2023-07-31T16:05:48-06:00
Enable VK_KHR_maintenance_5 support
The extension changes the behavior of vkGetDeviceProcAddr to no longer allow
querying of core functions beyond the version specified in VkApplicationInfo.
Thus, a check is needed to ensure that if the extension is enabled, the
apiVersion is sufficient for the function to be returned.
-
5bc25766
by Charles Giessen at 2023-08-02T12:46:31-06:00
Make maintenance 5 require the feature to be enabled
The maintenance 5 behavior should only apply when the feature is enabled in
addition to the extension being enabled.
-
afdd025e
by Mike Schuchardt at 2023-08-04T17:15:37-06:00
build: Update to header 1.3.261
- Update known-good
- Generate source
-
acff4336
by Charles Giessen at 2023-08-07T16:37:56-06:00
Add CRT Warnings & fix them
Fixes the many uses of strncpy and strncat to use versions of the functions
which the CRT approves of. This means adding the length of the destination
string as a parameter.
The function loader_platform_combine_path was removed and the single use of
it was replaced with a call to snprinf, which achieves the same goal.
There are a few other functions that the CRT warns about, like fopen and
the wide char version of strcpy. These were also replaced with the 'safe'
functions.
-
38d11c05
by Charles Giessen at 2023-08-09T13:50:28-06:00
Consolidate envvar filters into single struct
There are many places where both the enable & disable envvar filter are
passed down into functions. This commit consolidates that by introducing
a new struct to hold both the enable & disable envvar filter. This
reduces the number of parameters to many functions and streamlines the
logic. It also enables future changes to what filters are available.
-
6b4c7125
by Charles Giessen at 2023-08-09T13:50:28-06:00
Move filter Env-Var parsing to top level functions
The loader was querying the layer environment variable filters multiple
times during instance creation. The solution is to move the queries out
of the function that use them and do them once at the start of every
API call that needs them. That way the filters can be passed into each
function and shared.
-
870fd572
by Charles Giessen at 2023-08-09T13:50:28-06:00
Add VK_LOADER_LAYERS_ALLOW environment variable.
This new environment variable prevents the VK_LOADER_LAYERS_DISABLE
env-var from applying to layers in the VK_LOADER_LAYERS_ALLOw env-var.
The purpose of it is to act like VK_LOADER_LAYERS_ENABLE in regards to
VK_LOADER_LAYER_DISABLE without force enabling the layers. That way,
implicit layers which normally would only be enabled in certain
circumstances (eg their enable_environment is set) can be allowed
while still disallowing other implicit layers.
-
4830af39
by Charles Giessen at 2023-08-09T15:11:04-06:00
Document VK_DRIVER_FILES ability to look in folders
Orinigally VK_ICD_FILENAMES was documented to only be able to use full paths to
ICD Manifest files. This is untrue, as VK_ICD_FILENAMES, and its replacement
VK_DRIVER_FILES is able to find drivers using full paths as well as paths to
folders containing manifest files. This commit amends the documentation to
reflect that capability as well as adding a test for that use case.
-
dd8332d2
by Charles Giessen at 2023-08-18T10:05:18-06:00
Add support for AppleClang and iOS cross compilation
Compiling for iOS on an intel mac failed due to not handling the locations of
gen_defines.asm and asm_offset.s when running under AppleClang. This solution
works for the toolchain file used during development but may not work in other
situations.
iOS does not support secure_getenv, which is fine, except that the cmake
code check_function_exists seems to think it is supported, causing compilation
to fail. Just hardcoding secure_getenv to not be supported is enough for
the unix shim logic to compile.
The compilation revelaed a few issues in the test code, like not using
[[maybe_unused]] and a signed/unsigned comparison.
-
7dca451d
by Mike Gorchak at 2023-08-24T14:34:30-06:00
1. Update build-qnx content to make it buildable again.
2. Switch __QNXNTO__ macro check to __QNX__
During last 23 years the QNX Neutrino microkernel was active, __QNXNTO__ macro belongs to it. Now QNX Muon microkernel is under development, so __QNX__ macro covers both versions: Neutrino and Muon.
First public announce of QNX Muon was here: https://blogs.blackberry.com/en/2023/04/get-in-the-sdv-podcast-from-blackberry-season-2-episode-3
-
2896ff0b
by Juan Ramos at 2023-08-25T12:11:36-06:00
cmake: Fail when building for Android
-
5c15f9d8
by Juan Ramos at 2023-08-25T12:11:36-06:00
cmake: Cleanup Threads::Threads logic
Android isn't supported
-
29263a3c
by Juan Ramos at 2023-08-25T12:25:57-06:00
cmake: Fix gtest CMake warning
https://github.com/google/googletest/pull/4288
-
d34bfaff
by Mike Schuchardt at 2023-08-25T12:45:18-07:00
build: Update to header 1.3.262
- Update known-good
- Generate source
-
e95fee0b
by Mike Schuchardt at 2023-09-05T12:48:00-07:00
build: Update to header 1.3.263
- Update known-good
- Generate source
-
a145cbe9
by Shahbaz Youssefi at 2023-09-08T09:31:54-06:00
MSAN fixes
-
40cebdf5
by Charles Giessen at 2023-09-08T15:56:37-06:00
Fix incorrect handling of Debug Marker functions
The implementation for VK_KHR_maintenance_5 exposed a bug in how the function
for debug_marker functions were gotten. The bug was to only check if a
driver supports a physical device when querying for device function pointers,
which ignores the possibility of a layer supporting a device extension. This
is an issue for VK_EXT_debug_marker, which requires trampoline functions to
properly unwrap data passed in, resulting in the various debug marker functions
returning NULL instead of a valid function pointer.
-
cfe07e36
by Charles Giessen at 2023-09-08T15:56:37-06:00
Add Debug extension support to test layer
Debug utils, debug report, and debug marker are now supported directly in the
test layer, allowing easy testing of the behavior of layers which support
these debug extensions.
This allows testing the matrix of combinations between drivers, layers, and
loader support for these debug extensions.
This commit also adds a 'injected_extension' concept into the test_layer,
which allows recreating the behavior of layers which modify the extension
list returned by the driver.
-
7eb9da1e
by Charles Giessen at 2023-09-08T15:56:37-06:00
Make test_layer delete destroyed devices
Destroyed devices need to be removed from the test_layer's created_devices
vector, so that it doesn't accidentally mistake dead devices for alive ones
when checking for whether a device extension is supported or not.
This caused multiple days of debugging headache as it caused sporadic test
failures due to the re-use of VkDevice handle values (which is caused by
the memory manager reusing allocations). Since a second VkDevice could share
the handle value of the first, and the first wasn't removed from the vector,
test_layer would use the data assocated with the first device by mistake.
-
1c827fd7
by Mike Schuchardt at 2023-09-11T11:14:24-07:00
build: Update to header 1.3.264
- Update known-good
- Generate source
-
1e09b25e
by Charles Giessen at 2023-09-12T14:23:26-06:00
Add device dispatch table magic value check
The device dispatch table has a magic value to ensure consistency, but
there was no message logged in case the magic value was corrupted. This
commit adds that check, fixes the message being printed for the instance
magic value check, and adds tests to ensure they are contining to be
checked in the future.
-
983016a6
by Juan Ramos at 2023-09-12T16:44:15-06:00
cmake: Fix MinGW vulkan.pc
Reverts KhronosGroup/Vulkan-Loader/pull/670 which produces an
invalid .pc file
closes #1278
-
e2e3cb97
by sfan5 at 2023-09-12T21:34:04-06:00
cmake: Only search for MASM when using MSVC
-
21b2a9dd
by Juan Ramos at 2023-09-13T10:29:52-06:00
cmake: Simplify install code
-
d40385b1
by Juan Ramos at 2023-09-13T13:32:59-06:00
cmake: Add find_package support
-
45b155b0
by Charles Giessen at 2023-09-15T13:49:26-06:00
Check correct magic value in device dispatch table
The check for a correct magic value in the device dispatch table used
LOADER_MAGIC_NUMBER instead of DEVICE_DISP_TABLE_MAGIC_NUMBER. This causes
every device creation to emit the 'invalid magic value' message, which is
wrong. This commit fixes that, as well as adds the expected value to the
log message.
-
9dc0e315
by Charles Giessen at 2023-09-17T19:13:09-06:00
Use backtick instead of single quote in Loader Debugging
Surrounding text with ~ causes markdown to format the text with strike through, which is not intended. Surrounding the ~ with backticks instead of single quotes fixes it.
-
4f8c7962
by Charles Giessen at 2023-09-21T12:33:18-06:00
Fix warning message refering to layers instead of ICDs
The warning message about the binary having the wrong bitness for
ICD's was wrongly stating it was about layers having the wrong
bitness.
-
c47c78c8
by Mike Schuchardt at 2023-09-25T11:17:08-07:00
build: Update to header 1.3.265
- Update known-good
- Generate source
-
537dd252
by Richard S. Wright Jr at 2023-09-26T18:02:44-04:00
WIP: Loader seems to work on iOS
-
480441ae
by Richard S. Wright Jr at 2023-09-26T18:02:44-04:00
WIP: Added defines for iOS
-
fcb2cd50
by Richard S. Wright Jr at 2023-09-26T18:02:44-04:00
removed toolchain
-
22ed25c8
by Richard S. Wright Jr at 2023-09-26T18:02:44-04:00
Tweaked CMakeLists.txt for better organization
-
f352069a
by Richard S. Wright Jr at 2023-09-26T18:42:03-04:00
XCode fix - warnings as errors and unused parameter triggers it
-
af32f69c
by Joyce Brum at 2023-09-28T13:14:54-06:00
feat: enable codeql
Signed-off-by: Joyce Brum <joycebrum@google.com>
-
9e33cfc6
by Mike Schuchardt at 2023-09-29T09:08:11-07:00
build: Update to header 1.3.266
- Update known-good
- Generate source
-
d23320bc
by Christopher Degawa at 2023-10-02T10:43:37-06:00
loader/cJSON: Prefix/mark static/remove symbols
Prefixes the symbols that are used outside the file with `loader_` to
match the others. Marks symbols that are not used outside as static.
Removes the symbols that are not used at all.
Prevents conflicts with other libraries that might also use cjson.
This may cause issues if the internal checkout of cJSON is updated, in
that case, it may be simpler to just prefix all of cJSON's symbols with
`loader_cJSON_`.
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
-
0a5fdecf
by Charles Giessen at 2023-10-02T14:17:44-06:00
Fix problems detected by CodeQL static analysis
3 types of issues were found:
* Incorrect format specifiers
* Not providing required format specifies
* Using alloca in a loop
There are multiple instances of alloca in loops, but to fix them would
require significant refactoring. This commit includes 1 move of alloca inside
a for loop to the outside, but this is because the logic was redoing work
in a for loop that could have been done once at the start of the function.
-
ffb46f8f
by Christopher Degawa at 2023-10-04T11:34:16-06:00
loader: Fix cross-compiling with jwasm
fixes a few issues when cross-compiling from linux to windows using
mingw-w64. Particularly with the result of jwasm not being used in the
library. Additionally, allows running the generated asm_offset binary
with wine, if the user provided the wrapper in their toolchain with
`-DCMAKE_CROSSCOMPILING_EMULATOR=wine`.
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
-
e979f24a
by Christopher Degawa at 2023-10-04T11:34:16-06:00
loader: Add uasm as an alternative name for jwasm
uasm is a drop-in replacement for jwasm most of the time, but doesn't
always provide a binary named jwasm (such as on archlinux).
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
-
6a03592f
by Christopher Degawa at 2023-10-04T11:34:16-06:00
loader/asm_offset: Add __USE_MINGW_ANSI_STDIO
This fixes warnings generated when compiling with mingw-w64 regarding
printf format specifiers that are not available with base msvcrt.
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
-
fbea9b27
by Christopher Degawa at 2023-10-04T11:34:16-06:00
actions: Re-add -DUSE_MASM=OFF
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
-
dedcfae3
by Christopher Degawa at 2023-10-04T11:34:16-06:00
github: re-enable normal mingw build
pulls uasm from msys2
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
-
a37ec45d
by Charles Giessen at 2023-10-04T11:37:00-06:00
Remove unnecessary comment in build.yml
-
d9faa0f8
by Juan Ramos at 2023-10-04T15:05:23-06:00
cmake: Cleanup package config code
-
c2774718
by Juan Ramos at 2023-10-04T15:47:38-06:00
cmake: Remove PRIVATE_LIBS from vulkan.pc.in
We don't ship APPLE AND BUILD_STATIC_LOADER so supporting
the pkg-config for it is unneccessary and error prone.
This makes both configuration files consistent.
-
34af39fc
by Juan Ramos at 2023-10-04T16:13:07-06:00
cmake: Remove CMAKE_INSTALL_INCLUDEDIR_PC
Currently this just will default to `include` IE it will default
to system includes.
Which gcc already searches for:
https://stackoverflow.com/a/19839946/19739129
Now vulkan.pc will more closely match VulkanLoaderConfig.cmake
-
6a73702b
by Juan Ramos at 2023-10-04T21:03:25-06:00
docs: New SDK branch convention
Next SDK we will be changing branch/tag naming scheme from
sdk-1.x.yyy to vulkan-sdk-1.x.yyy
-
7405cd46
by Juan Ramos at 2023-10-04T21:04:24-06:00
gn: asm_offset.c shouldn't be compiled
asm_offset.c only makes sense for an executable
-
7417583f
by Juan Ramos at 2023-10-05T12:45:06-06:00
cmake: Don't REQUIRE find_package(VulkanHeaders)
Allows use of add_subdirectory with the loader
This is the same approach used by the validation layers.
-
25c55273
by Christopher Degawa at 2023-10-05T16:44:15-06:00
loader: Add check for working MASM compiler
CMake's detection of MASM is very broken, especially if not using MSVC.
This adds a check to see if MASM is working, and if not, disables it,
going back to the fallback path, as intended.
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
-
1655ef77
by Christopher Degawa at 2023-10-05T16:44:15-06:00
github: split mingw-no-asm job
Splits the mingw-no-asm job into an explicit -D USE_MASM=OFF and one
without to test the automatic detection of MASM.
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
-
6d4f07c9
by Mike Schuchardt at 2023-10-06T09:33:44-07:00
build: Update to header 1.3.267
- Update known-good
- Generate source
-
520eaa5a
by Juan Ramos at 2023-10-09T10:08:33-06:00
cmake: Fix vulkan.pc regressions
closes #1318, #1319
-
f4c838e2
by Mike Schuchardt at 2023-10-16T08:26:02-06:00
build: Update to header 1.3.268
- Update known-good
- Generate source