Previously the logic to free all the components of loader_layer_properties was spread
across a half dozen different places, resulting in leaks. This commit moves the logic
into a single location, centralizing the process and making it easier to add new
fields to the loader_layer_properties struct.
Made InstanceWrapper and DeviceWrapper simpler to use by moving them to test_environment
then making the Create() member functions and doing the gtest assertions in the function
itself.
Additionally:
Removed the `detail` namespace in the test_environment.
Renamed get_new_test_icd/layer to just `reset_icd/layer`. This is clearer about what it
is doing and makes the interface more expressive with code such as
`env->reset_icd().SetMinInterfaceVersion(5);`
Before it was a mix of camelCase, PascalCase, and snake_case.
"Vulkan" functions, like terminator_GetPhysicalDeviceProperties, remain in camelCase.
This way it looks visually similar with the actual vulkan functions they correspond to.
This change allows the loader to know extensions enabled in the layers
as well as extensions enabled but handled by layers.
This should fix several issues where the enabled extensions is not
known soon enough for layers to use.
Issue #245 was created because we were not properly using the XDG
paths.
This change updates the path search order to be more correct.
While an argument could be made that the loader really should only
be looking in the DATA folders, we already are looking in the
CONFIG folders. Therefore, just correct the order and also make
sure the proper _HOME variable for CONFIG and DATA is searched
first (but only in non-superuser mode).
Added functions which check handle values using GTEST. Includes:
checking for null, not null, equality of two handles, and variants that
operate on vectors and arrays.
Add support for tests which use device groups by adding a new structure that
holds pointes to PhysicalDevice structs and implementing the necessary vulkan
API calls.
This commit also:
- Formats test_icd.cpp
- Makes vk_icdGetPhysicalDeviceProcAddr return stuff by refactoring the
instance procaddr functions
This wrapper allows easy reading of the log output through the debug utils
messenger infrastructure. Since getting the stdout/stderr is not well
supported by googletest, this allows tests to be written which check for
specific log messages to be emitted, allowing another way to verify the
loader is behaving as expected.
On linux, when the loader fails to load a .so if it was due to being on the
wrong architecture, the loader downgraded the error to INFO level. This
commit does the same thing for windows. Error code 193 is winapi's way to
signify that the dll failed to load cause of the architecture.
The test used to only keep track of the maximum number of allocations and fail
if it was exceeded, as calling free would decrease this number. Now tests use
the total number of times allocate was called, and realloc was added to this
metric. This should offer better OOM coverage due to failing at each and
every possible OOM place. The code does make sure not to increase the count
if realloc was called to 'downsize' the allocation, which shouldn't cause
OOM to occur ever.
This test tries to recreate an out of memory condition which causes
a binary of the wrong type to be confused with a valid binary, which
causes VK_ERROR_INCOMPATIBLE_DRIVER to be returned instead of VK_SUCCESS
(Or OOM if the case may be)
When a dll/so of the wrong architecture is found, the loader would
return ERROR_INCOMPATIBLE_DRIVER from `loader_scanned_icd_add`.
Previously it would return VK_SUCCESS, but that caused the logic to
not skip over the ICD. This commit fixes the issue where the error
code would be propagated out of the function, which shouldn't happen
since there may be other drivers which do successfully load.
Added the `CURRENT_PLATFORM_DUMMY_BINARY` macro which thanks to platform
defines contains the path of the binary which is 'wrong' for the current
architecture. EX: compiling with Win64, it points to the Win32 binary, and vice
versa when compiling for Win32. Same logic applies for linux 64/32 bit.
These binaries are necessary for testing whether the loader correctly
ignores binaries of the wrong architecture. Since they are data files
more than executables, they are being checked in.
Currently only Unix binaries are added but in the future windows along
with any other platform binaries will be added.
This changes the loader to always set the version to the one which was used when
generating the source files that are checked into the repo, instead of using the
version gotten from the Vulkan-Headers find cmake file.
Change-Id: Id0955ddfd10e35e0f358f5a77799d8baa4992b04
Previously, clang-format was required for all new commits but the codebase
itself wasn't conformant. This commit formats the source files in the loader
folder.
Adds FALLBACK_DATA_DIRS, FALLBACK_CONFIG_DIRS, SYSCONFDIR, and EXTRASYSCONFDIR
to the list of redirected paths. They were previously 'covered' by manual entries.
This commit makes them responsive to changes in the build system.
This commit also makes sure that the path used for redirection is one searched by
the loader by using the SYSCONFIG variable. Previously it would use /usr/local/etc/
which was only correct on systems where CMAKE_INSTALL_PREFIX was set to /usr/local.
KhronosGroup/Vulkan-ValidationLayers switched to this method a while ago
and this syncs the KhronosGroup/Vulkan-Loader version of
helper_file_generator.py to match.
Add logging that will allow end-users to specifically just look at
messages for layers and implementations/ICDs.
Setting VK_LOADER_DEBUG to include one of the following:
- layer : enables layer-specific logging
- implem : enables implementation/ICD-specific logging
The loader_log messages were using the DEBUG_REPORT log levels
which just happened to coincide with the existing LOADER_ log levels.
Going forward, to add layer logging in its own level, this would not
have worked.
Vulkan Loader loads the meta layer list and filters the ones that are
not valid. During filter it deallocates the attributes of the loaded
meta layer but does not deallocate the associated extension list.
Calling `dlclose` doesn't necessarily mean that the static variables will
be reset nor the libraries destructor gets called. This caused cascading
errors in tests on linux with GCC. By always manually resetting the ICD
or Layer before each test, we prevent any funny business from occuring.