platform/upstream/Vulkan-Loader.git
3 years agotest: Update 32/64 tests to check the log
Charles Giessen [Wed, 25 Aug 2021 22:43:58 +0000 (16:43 -0600)]
test: Update 32/64 tests to check the log

Use the DebugUtilsLogger to verify that the loader is downgrading the error
level of dll/so's from ERROR to INFO

3 years agotest: Add DebugUtilsWrapper
Charles Giessen [Wed, 25 Aug 2021 22:41:59 +0000 (16:41 -0600)]
test: Add DebugUtilsWrapper

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.

3 years agoloader: Downgrade wrong arch errors on windows
Charles Giessen [Wed, 25 Aug 2021 22:39:26 +0000 (16:39 -0600)]
loader: Downgrade wrong arch errors on windows

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.

3 years agobuild: Update to header 1.2.189
Mike Schuchardt [Tue, 17 Aug 2021 18:03:50 +0000 (11:03 -0700)]
build: Update to header 1.2.189

- Update known-good
- Generate source

3 years agotest: Set VK_LAYER_PATH properly
Charles Giessen [Mon, 16 Aug 2021 23:13:13 +0000 (17:13 -0600)]
test: Set VK_LAYER_PATH properly

3 years agotest: Update Device Layers Match test
Charles Giessen [Mon, 16 Aug 2021 22:41:42 +0000 (16:41 -0600)]
test: Update Device Layers Match test

Move the old EnumerateDeviceLayers.LayersMatch to the new framework,
implementing the necessary components in the TestLayer code path.

3 years agotest: Use proper allocation count in tests
Charles Giessen [Mon, 16 Aug 2021 20:59:10 +0000 (14:59 -0600)]
test: Use proper allocation count in tests

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.

3 years agotest: Add test for PR #639
Charles Giessen [Mon, 16 Aug 2021 17:32:30 +0000 (11:32 -0600)]
test: Add test for PR #639

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)

3 years agoloader: Fix accidental error propagation
Charles Giessen [Mon, 16 Aug 2021 18:00:26 +0000 (12:00 -0600)]
loader: Fix accidental error propagation

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.

3 years agoFix Vulkan CTS testcase bug: "create_instance_device_intentional_alloc_fail"
WenqingLiAMD [Mon, 9 Aug 2021 09:56:13 +0000 (17:56 +0800)]
Fix Vulkan CTS testcase bug: "create_instance_device_intentional_alloc_fail"

In function loader_scanned_icd_add, if open_library fails, VK_SUCCESS
is still returned, which would cause the bad number of good ICDs.

3 years agotest: Simplify wrong arch tests by adding a macro
Charles Giessen [Mon, 16 Aug 2021 03:21:37 +0000 (21:21 -0600)]
test: Simplify wrong arch tests by adding a macro

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.

3 years agotest: Add windows 32/64 bit binary tests
Charles Giessen [Fri, 13 Aug 2021 23:00:53 +0000 (17:00 -0600)]
test: Add windows 32/64 bit binary tests

Added both layer and ICD tests. Included lengthy description of why the test
successfully creates an instance even though it really shouldn't.

3 years agotest: Add linux x64 and x86 for wrong binaries
Charles Giessen [Fri, 13 Aug 2021 15:47:54 +0000 (09:47 -0600)]
test: Add linux x64 and x86 for wrong binaries

Test only looks for ICD binaries.

3 years agotest: Add ELF test binaries for 32 and 64 bit
Charles Giessen [Thu, 12 Aug 2021 23:03:14 +0000 (17:03 -0600)]
test: Add ELF test binaries for 32 and 64 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.

3 years agoloader: Make use of a generated header version
Charles Giessen [Thu, 17 Jun 2021 23:24:57 +0000 (17:24 -0600)]
loader: Make use of a generated header version

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

3 years agoloader: Reformated loader source code
Charles Giessen [Tue, 10 Aug 2021 20:35:29 +0000 (14:35 -0600)]
loader: Reformated loader source code

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.

3 years agotest: Revamp which linux paths are redirected
Charles Giessen [Tue, 10 Aug 2021 22:07:55 +0000 (16:07 -0600)]
test: Revamp which linux paths are redirected

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.

3 years agoFix environment test failure.
Mark Young [Wed, 11 Aug 2021 15:38:58 +0000 (09:38 -0600)]
Fix environment test failure.

It was looking for a specific output for the manifest file search string.
Re-add that string for now.

3 years agobuild: Update to header 1.2.188
Mike Schuchardt [Tue, 10 Aug 2021 18:10:28 +0000 (11:10 -0700)]
build: Update to header 1.2.188

- Update known-good
- Generate source (no change)

3 years agoscripts: Use altlen instead of parsing latexmath
Mike Schuchardt [Tue, 10 Aug 2021 18:01:55 +0000 (11:01 -0700)]
scripts: Use altlen instead of parsing latexmath

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.

3 years agoAllow "icd" as well as "implem" for VK_LOADER_DEBUG
Mark Young [Wed, 4 Aug 2021 22:33:03 +0000 (16:33 -0600)]
Allow "icd" as well as "implem" for VK_LOADER_DEBUG

3 years agoAdd layer and implementation-specific logging
Mark Young [Tue, 3 Aug 2021 21:56:26 +0000 (15:56 -0600)]
Add layer and implementation-specific logging

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

3 years agoFix loader_log messages to use LOADER_ log levels
Mark Young [Tue, 3 Aug 2021 18:57:25 +0000 (12:57 -0600)]
Fix loader_log messages to use LOADER_ log levels

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.

3 years agotest: Prevent macro collision
Charles Giessen [Wed, 4 Aug 2021 17:16:40 +0000 (11:16 -0600)]
test: Prevent macro collision

3 years agotest: Make MetaLayer test add extensions
Charles Giessen [Wed, 4 Aug 2021 16:31:40 +0000 (10:31 -0600)]
test: Make MetaLayer test add extensions

Needed to fixup more of the manifest writer in the process

3 years agotest: Make invalid meta layer test more comprehensive
Charles Giessen [Wed, 4 Aug 2021 16:18:33 +0000 (10:18 -0600)]
test: Make invalid meta layer test more comprehensive

This required fixing a few bugsin the Manifest file printing logic

3 years agotest: Add simple invalid-meta layer test
Charles Giessen [Wed, 4 Aug 2021 15:33:54 +0000 (09:33 -0600)]
test: Add simple invalid-meta layer test

Creates a meta layer whose component layers do not exist

3 years agoDeallocate the extension lists when deleting an item from layer list
Samiullah Khawaja [Wed, 4 Aug 2021 13:59:25 +0000 (13:59 +0000)]
Deallocate the extension lists when deleting an item from layer list

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.

3 years agotest: Clear TestICDs before each test
Charles Giessen [Wed, 4 Aug 2021 01:07:12 +0000 (19:07 -0600)]
test: Clear TestICDs before each test

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.

3 years agotest: Update tests/README.md
Charles Giessen [Tue, 3 Aug 2021 21:54:35 +0000 (15:54 -0600)]
test: Update tests/README.md

Include note to always destroy the instance at the end of a test.

3 years agotest: Make all tests call vkDestroyInstance
Charles Giessen [Tue, 3 Aug 2021 21:53:54 +0000 (15:53 -0600)]
test: Make all tests call vkDestroyInstance

This caused spurious failures in other tests due to the dynamic library
not being closed.

3 years agotest: Add CreateInstance.LayerPresent test
Charles Giessen [Tue, 3 Aug 2021 18:09:33 +0000 (12:09 -0600)]
test: Add CreateInstance.LayerPresent test

3 years agotest: Update framework_config to include paths to layer binaries
Charles Giessen [Tue, 3 Aug 2021 18:09:06 +0000 (12:09 -0600)]
test: Update framework_config to include paths to layer binaries

3 years agotest: Add noexcept in test_environment
Charles Giessen [Tue, 3 Aug 2021 18:08:37 +0000 (12:08 -0600)]
test: Add noexcept in test_environment

3 years agotest: add CreateInstance.LayerNotPresent test
Charles Giessen [Fri, 30 Jul 2021 17:43:43 +0000 (11:43 -0600)]
test: add CreateInstance.LayerNotPresent test

Remove the corresponding test in loader_validation_tests.cpp

3 years agotest: Implemente layer create instance/device
Charles Giessen [Fri, 30 Jul 2021 17:42:11 +0000 (11:42 -0600)]
test: Implemente layer create instance/device

Added the necessary bits to make calling create instance and device function,
though it may not work in all circumstances

3 years agobuild: Update to header 1.2.187
Mike Schuchardt [Tue, 3 Aug 2021 19:15:40 +0000 (12:15 -0700)]
build: Update to header 1.2.187

- Update known-good
- Generate source (no change)

3 years agoFix loader debug documentation
Mark Young [Mon, 2 Aug 2021 21:28:02 +0000 (15:28 -0600)]
Fix loader debug documentation

The loader debug environment variable (VK_LOADER_DEBUG) is not inclusive
of higher importance messages, it is exclusive to the types specifically
enabled.

3 years agotest: Add basic threading test
Charles Giessen [Thu, 29 Jul 2021 20:17:37 +0000 (14:17 -0600)]
test: Add basic threading test

Requires adding ability for device to return functions with
vkGetDeviceProcAddr that aren't necessarily useable functions.

Also added checks to make sure that the handle passed in by the loader
to the TestICD is the 'right handle' where necessary, as some functions
do not need to know which device is being called on, just that it is correct.

3 years agobuild: Update to header 1.2.186
Mike Schuchardt [Tue, 27 Jul 2021 19:41:31 +0000 (12:41 -0700)]
build: Update to header 1.2.186

- Update known-good
- Generate source (no change)

Change-Id: I7c0699f8613ecbfefe79981f34faa5e276703324

3 years agobuild: Update to header 1.2.185
Mike Schuchardt [Tue, 20 Jul 2021 16:48:39 +0000 (09:48 -0700)]
build: Update to header 1.2.185

- Update known-good
- Re-enable code generation for VK_HUAWEI_subpass_shading
- Generate source

Change-Id: I6607e1de097d1b8a2f631cd1f11b088204b8bb3a

3 years agobuild: Disable -Wimplicit-fallthrough in GN.
Jamie Madill [Tue, 20 Jul 2021 12:36:30 +0000 (08:36 -0400)]
build: Disable -Wimplicit-fallthrough in GN.

This flag was recently enabled by default in Chrome and ANGLE
and other projects inherit these build settings. Explicitly
dsiable this warning until it is enabled in the non-GN build.

Change-Id: I8f353f8abc3f7857481ff9cc774aff3618eaf35a

3 years agoloader: Dont return OOM on function load failure
Charles Giessen [Wed, 14 Jul 2021 18:12:40 +0000 (12:12 -0600)]
loader: Dont return OOM on function load failure

Win7 does not support D3DKMTEnumAdapters2, as such when the loader goes to
query it, it gets NULL back. Except, instead of just erroring out, it would
return VK_ERROR_OUT_OF_HOST_MEMORY. Problem was that change
73296a04678a07fc4fb1eef50cf4fe2778f059f8
starts checking for OOM, and finding one when running in Win7. This change
alters that behavior so that it doesn't report an OOM when one hasn't occured.

3 years agowindows: update the loader copyright date
Bob Ellison [Tue, 13 Jul 2021 22:30:39 +0000 (16:30 -0600)]
windows: update the loader copyright date

The date, specified in loader/loader.rc, was incorrectly set to 2020.

3 years agoci: Re-add code and commit formatting verification
Charles Giessen [Tue, 18 May 2021 21:56:56 +0000 (15:56 -0600)]
ci: Re-add code and commit formatting verification

Change-Id: I240f912daa03d001f2dbd2527d8374bbf394ac4a

3 years agoUpdate contact information
Mark Young [Tue, 13 Jul 2021 14:12:54 +0000 (08:12 -0600)]
Update contact information

3 years agotest: Move more old tests to new test framework
Charles Giessen [Thu, 8 Jul 2021 23:30:14 +0000 (17:30 -0600)]
test: Move more old tests to new test framework

Remove them from the calling scripts where appropriate. Notably the 'get count
then run tests and pass in count' are now using the framework where that is
completely redundant.

Change-Id: I00d561a85047742a849df48818398b10c62d3b74

3 years agoReport a warning if the number of GPUs doesn't match
Mark Young [Wed, 30 Jun 2021 16:02:53 +0000 (10:02 -0600)]
Report a warning if the number of GPUs doesn't match

We've encountered situations where a layer removes physical devices
from the list which can cause issues on some systems if it's done
incorrectly.  For now, simply throw a warning if the loader determines
that a layer has removed devices.

NOTE: In the long-run, I think we should define a policy which states
that layers can re-order devices, but not add or remove.  If a layer
wants to add, it should become an ICD.

3 years agobuild: Update to header 1.2.184
Mike Schuchardt [Tue, 6 Jul 2021 18:57:06 +0000 (11:57 -0700)]
build: Update to header 1.2.184

- Update known-good
- Generate source

Change-Id: Ib2cfed88095541a127c23cf7418e9a66d81bd35e

3 years agotest: Fix TestLayer exports on windows
Charles Giessen [Tue, 6 Jul 2021 00:39:16 +0000 (18:39 -0600)]
test: Fix TestLayer exports on windows

* `get_instance_func` needed to have __stdcall (VKAPI_ATTR) added
* Several .def files were incorrect
* vk_layer.h forward declares vkNegotiateLoaderLayerInterfaceVersion. This is
problomatic because it doesn't have __declspec(dllexport), a token added by
FRAMEWORK_EXPORT on windows. We have to special case the export macro here to
prevent that mismatched definition.

3 years agotest: Add Enumeration Function stubs to TestLayer
Charles Giessen [Mon, 5 Jul 2021 23:51:58 +0000 (17:51 -0600)]
test: Add Enumeration Function stubs to TestLayer

Change-Id: I68b3597877fed803f4284e7e67f19ce4e3e2fe53

3 years agotest: Flesh out TestLayer to include relevant exports
Charles Giessen [Fri, 2 Jul 2021 23:49:13 +0000 (17:49 -0600)]
test: Flesh out TestLayer to include relevant exports

Functions needed in the various layer interface versions are now
exported as well as guarded behind macros configurable from CMake.
The export_definitions folder was populated as well.

Change-Id: Iebfdd8ae02062eb81b8aa9f705885c9384c95be9

3 years agotest: Use MACRO=1 in TestICD for definition style
Charles Giessen [Mon, 5 Jul 2021 21:18:07 +0000 (15:18 -0600)]
test: Use MACRO=1 in TestICD for definition style

This replaces instances of `#ifdef MACRO_NAME` with `#if MACRO_NAME` as now
MACRO_NAME will have a value of 0 or 1, instead of it being defined or not
defined.

Change-Id: I27a4330511a0f0d779f41851fe816fc79e868de2

3 years agotest: Update Framework Readme.md
Charles Giessen [Fri, 2 Jul 2021 23:31:52 +0000 (17:31 -0600)]
test: Update Framework Readme.md

Change-Id: Iaf3740b046b3f6457c337988c573a73f068ff1a3

3 years agotest: Use a new `string_eq` function instead of raw strcmp
Charles Giessen [Fri, 2 Jul 2021 21:13:54 +0000 (15:13 -0600)]
test: Use a new `string_eq` function instead of raw strcmp

Change-Id: I703763133c42eb78ae3c6e194450411e3f784e35

3 years agotest: Drop fp_ from function pointer names
Charles Giessen [Fri, 2 Jul 2021 17:37:20 +0000 (11:37 -0600)]
test: Drop fp_ from function pointer names

Change-Id: Ibd047e99f442d4a9755ac186e16b3620d3544e37

3 years agotest: Remove some redundant tests in old test suite
Charles Giessen [Fri, 2 Jul 2021 16:54:09 +0000 (10:54 -0600)]
test: Remove some redundant tests in old test suite

Change-Id: Icc84b25bb092e15e054433651112e86b30726e52

3 years agotest: Rename regressions test cases
Charles Giessen [Fri, 2 Jul 2021 16:52:32 +0000 (10:52 -0600)]
test: Rename regressions test cases

From RegressionTests.CreateInstanceExampleTestCase
To CreateInstance.ExampleTestCase

Change-Id: Ibd74541f93edbcaccb3daa9016dcacf8ecccfa78

3 years agotest: Remove Allocation tests from old test suite
Charles Giessen [Fri, 2 Jul 2021 16:22:30 +0000 (10:22 -0600)]
test: Remove Allocation tests from old test suite

loader_alloc_callback_tests.cpp now contain all of the removed tests.

Change-Id: Ia99df3a8f86d40f0d5e89a62b7b0a5f9bebafb7c

3 years agobuild: Update to header 1.2.183
Mike Schuchardt [Wed, 30 Jun 2021 20:59:47 +0000 (13:59 -0700)]
build: Update to header 1.2.183

- Update known-good
- Generate source (no change)

Change-Id: I059e6c2d8430228b4f20cadb83929b220efa5d0d

3 years agodocs: Add info on DXGI adapters in Windows ICD Discovery
Charles Giessen [Tue, 29 Jun 2021 22:06:30 +0000 (16:06 -0600)]
docs: Add info on DXGI adapters in Windows ICD Discovery

3 years agocopyrights: updated copyrights on MIT files
Bob Ellison [Tue, 29 Jun 2021 22:43:12 +0000 (16:43 -0600)]
copyrights: updated copyrights on MIT files

During SDK testing we identified that the runtime copyrights
were out-of-date.  The loader runtime includes two separate
MIT copyrights, each attributed to a pair of source files,
one initiated by Dave Gamble and one by joseph werle.

I examined these files to discover that the last LunarG change to
three out of the four was actually in 2017, not 2016.  This
date should be attributed to Khronos, Valve, and LunarG.

By updating the copyright notice in these files, we ensure that
the license registry remains up-to-date.

Note that no real content changed (which is why the copyrights are not
being updated to 2021).

3 years agoLoader shared lib: back to default cmake prefix
xantares [Thu, 17 Jun 2021 16:48:53 +0000 (18:48 +0200)]
Loader shared lib: back to default cmake prefix

but it changed the import lib name (libvulkan.dll.a instead of libvulkan-1.dll.a) which in turns breaks cmake detection in FindVulkan
now we go back to using the default cmake prefix which is equivalent to what #595 wants, (prior to #523), but without the broken behavior

cc @Biswa96

3 years agotest: Delete old temp folders when starting tests/framework/test_util
Charles Giessen [Wed, 23 Jun 2021 19:58:39 +0000 (13:58 -0600)]
test: Delete old temp folders when starting tests/framework/test_util

Make sure the work space is clean before starting a test, this is mainly for developer builds, as CI
runs will generally wipe the entire build tree instead.

3 years agotest: Update googlestest to 1.10.0
Charles Giessen [Wed, 23 Jun 2021 18:14:57 +0000 (12:14 -0600)]
test: Update googlestest to 1.10.0

3 years agotest: Add revamped allocation tests
Charles Giessen [Wed, 23 Jun 2021 18:08:02 +0000 (12:08 -0600)]
test: Add revamped allocation tests

Creates a memory tracker class and rewrites the existing allocation tests.

Change-Id: I09ca2dc5b4d83f775ae0e3fd362a3fa4f7255d27

3 years agoci: Enable regression tests on MacOS
Charles Giessen [Fri, 4 Jun 2021 22:49:41 +0000 (16:49 -0600)]
ci: Enable regression tests on MacOS

Change-Id: I85b08bfd2914e03840a027240470e2596415f4dc

3 years agotest: Fix framework to work on MacOS
Charles Giessen [Tue, 8 Jun 2021 02:08:16 +0000 (20:08 -0600)]
test: Fix framework to work on MacOS

Main issue was getting function redireciton to work, dyld-interposer accomplishes that.
It required making the shim-library a dylib, but otherwise only required minor changes.

Change-Id: I7b7e2c86cc0c0b082f58241a7e146b74af72e792

3 years agobuild: Update to header 1.2.182
Mike Schuchardt [Mon, 21 Jun 2021 13:44:34 +0000 (06:44 -0700)]
build: Update to header 1.2.182

- Update known-good
- Disable codegen for VK_HUAWEI_subpass_shading
  https://github.com/KhronosGroup/Vulkan-Docs/issues/1564
- Generate source

Change-Id: If59954254bdf433bd5171f2a63cad88e34069c89

3 years agoAdd layer manifest version 1.2.0 to history
Christophe [Thu, 17 Jun 2021 14:26:24 +0000 (16:26 +0200)]
Add layer manifest version 1.2.0 to history

3 years agobuild: Update to header 1.2.181
Mike Schuchardt [Mon, 14 Jun 2021 17:33:15 +0000 (10:33 -0700)]
build: Update to header 1.2.181

- Update known-good
- Generate source (no change)

Change-Id: I7aed911c95d3faa89f7cd012ce56ccde00927943

3 years agoloader: Change VkResult when no ICDs were found
Charles Giessen [Thu, 10 Jun 2021 02:08:11 +0000 (19:08 -0700)]
loader: Change VkResult when no ICDs were found

ReadDataFilesInRegistry would return VK_ERROR_INITIALIZATION_FAILED in several cases
which could cause the loader to short cirtuit and return that value when no drivers were
found in the registry. This is inconsistent with the later check of the size of the list
of manifest, which if it is 0 returns VK_ERROR_INCOMPATABLE_DRIVER. This commit changes
the instances of INIT_FAILED into INCOMPATABLE_DRIVER where relevant.

3 years agoloader: Create AddManifestFile function
Charles Giessen [Thu, 10 Jun 2021 02:04:05 +0000 (19:04 -0700)]
loader: Create AddManifestFile function

3 years agoloader: Replace consistency checks with asserts
Charles Giessen [Thu, 10 Jun 2021 02:02:47 +0000 (19:02 -0700)]
loader: Replace consistency checks with asserts

3 years agotest: Refactor tests that use VK_ICD_FILENAMES
Charles Giessen [Sun, 6 Jun 2021 18:40:34 +0000 (12:40 -0600)]
test: Refactor tests that use VK_ICD_FILENAMES

Change-Id: I34117fd500f7110669ae19d32ff1e1be920238a9

3 years agotest: Control process elevation on Windows
Charles Giessen [Sun, 6 Jun 2021 10:01:28 +0000 (04:01 -0600)]
test: Control process elevation on Windows

Since the loader only uses environment variables if the process is
not running with elevated priviledges, the test harness needs to be
able to control that aspect to ensure consistency as CI systems may
run the tests in an 'elevated' context.

Change-Id: I8b15a1ecd4ab4960049ba198af8199943e872bba

3 years agotest: Delete files properly on windows
Charles Giessen [Sun, 6 Jun 2021 02:19:36 +0000 (20:19 -0600)]
test: Delete files properly on windows

Move windows specific error reporting to test_util.h
This allows for its use anywhere its required.

Change-Id: I14a0da85dc0d3f4e651b99aa005469b47d98d940

3 years agoci: Enable building of tests
Charles Giessen [Thu, 3 Jun 2021 22:47:19 +0000 (15:47 -0700)]
ci: Enable building of tests

3 years agotest: Fix Windows x86 icd shim exports
Charles Giessen [Thu, 3 Jun 2021 22:24:06 +0000 (15:24 -0700)]
test: Fix Windows x86 icd shim exports

_stdcall in Windows x86 builds would mangle names even with `export "C"`
By adding .def files, the correct name is used in the .dll and the loader will
correctly load it.

Additionally, ShimEnumAdapters2 needs _stdcall for 32 bit mode

Change-Id: Ia60a5e2a9e4378dc3e09864648e04852b10fe524

3 years agoci: Enable regression tests in Windows CI
Charles Giessen [Thu, 3 Jun 2021 22:23:24 +0000 (15:23 -0700)]
ci: Enable regression tests in Windows CI

Change-Id: I5bb1d03f9c9a3be82f7ed0763a325996a5d8dae8

3 years agobuild: Update to header 1.2.180
Mike Schuchardt [Mon, 7 Jun 2021 16:33:35 +0000 (09:33 -0700)]
build: Update to header 1.2.180

- Update known-good
- Generate source (no change)

Change-Id: I56d4483f777754c9e368ac9b0025d550070fdd83

3 years agoGN: Support custom library name.
Jamie Madill [Wed, 26 May 2021 13:45:20 +0000 (09:45 -0400)]
GN: Support custom library name.

This allows for projects like ANGLE that build the loader to prevent
conflicts with the system.

3 years agoCMake: Fix linking option and libraries for MinGW.
Biswapriyo Nath [Mon, 31 May 2021 07:16:38 +0000 (12:46 +0530)]
CMake: Fix linking option and libraries for MinGW.

Check MSVC for Visual Studio specific libraries.

3 years agoloader: Silence erroneous implicit layer warning
Charles Giessen [Wed, 19 May 2021 04:36:35 +0000 (22:36 -0600)]
loader: Silence erroneous implicit layer warning

When the override layer or an implicit meta layer is detected, the loader will
go and find all of the explicit layers because the override/meta layer might
require them. During that process `loaderAddLayerProperties` is called. It was
accidentally called with `is_implicit = true`, which causes the loader to interpret the manifest files as if they were implicit, generating
many erroneous warnings.

Change-Id: I8bc6bfa0d2a81159ebc33406e18ebf2099355768

3 years agotests: Include <memory> in test_util.h
Charles Giessen [Thu, 27 May 2021 23:56:06 +0000 (17:56 -0600)]
tests: Include <memory> in test_util.h

Change-Id: If2b6766521dd6bea5478b6316eadef8ce3e048cf

3 years agoci: Make linux CI run regression tests
Charles Giessen [Fri, 23 Apr 2021 18:37:46 +0000 (12:37 -0600)]
ci: Make linux CI run regression tests

Change-Id: I212a714cc0ec41da11bc69e216b4bb54685415a7

3 years agocmake: Only enable testing with BUILD_TESTS
Charles Giessen [Fri, 23 Apr 2021 18:34:05 +0000 (12:34 -0600)]
cmake: Only enable testing with BUILD_TESTS

`enable_testing()` was previously always enabled when configuring
the loader repository. This commit only does that when `BUILD_TESTS`
is true.

Change-Id: I75666088b84efc4613f72e6938da9ed88b54fb1f

3 years agoloader: Add pragma once to adapters.h
Charles Giessen [Fri, 23 Apr 2021 18:33:12 +0000 (12:33 -0600)]
loader: Add pragma once to adapters.h

This allows the header to be included multiple times without error.

Change-Id: I4f4ca4ab57c0b7f8606f397d61dadfadc2597b0b

3 years agotests: Add CMake to handle Detours library
Charles Giessen [Fri, 23 Apr 2021 18:29:36 +0000 (12:29 -0600)]
tests: Add CMake to handle Detours library

The Detours library uses a make file to build it. Thus it needed
to be translated into CMake equivalent code to make a useable target.

Change-Id: Ibed33c962e522f44297c7fa9cbe3f62964503ceb

3 years agotests: fix spelling in loader_validation_tests
Charles Giessen [Fri, 23 Apr 2021 18:29:10 +0000 (12:29 -0600)]
tests: fix spelling in loader_validation_tests

Change-Id: I2e278b959cd1d47bdc0d7fc19965e4d57e71b481

3 years agotest: Add regression tests code
Charles Giessen [Fri, 23 Apr 2021 18:20:15 +0000 (12:20 -0600)]
test: Add regression tests code

These files are the current 4 source code files used to create the
regression test suite

loader_regression_tests.cpp and loader_version_tests.cpp contain a
majority of the tests.

loader_wsi_test.cpp is all the tests pertaining to the WSI functions
in the loader.

loader_testing_main.cpp contains the `main()` which has windows CRT
specific calls to disable popups and debug aserts.

There are two executables created, test_regression and test_wsi.
test_regression is both regression_tests and version_tests. test_wsi
is the WSI tests. These tests are separate as they rely on linking
with platform specific windowing libraries which may not be present
on a CI system.

Change-Id: I1c02b0f82826d337599f4a9a7c02dde40ea5afa3

3 years agotest: Add framework test_environment
Charles Giessen [Fri, 23 Apr 2021 18:07:08 +0000 (12:07 -0600)]
test: Add framework test_environment

The test environment is the code which glues the platform shim,
TestICD, and TestLayers together so that test code can be easily
written. The main components tests use are the SingleICDShim and
MultipleICDShim classes. Both take care of copying the ICD binaries,
setting up the manifests, and redirecting the platform specific
systems to point at those manifests.

Change-Id: I7cbb76c9555fe13b323173c3838cbb3616b77a18

3 years agotest: Add test framekwork layer utility
Charles Giessen [Fri, 23 Apr 2021 18:01:07 +0000 (12:01 -0600)]
test: Add test framekwork layer utility

At the present moment, this change is to define simple layer
utilities that tests in the future may use.

Change-Id: I9ab5e1950da64061997891a0527d0f70a49e41e7

3 years agotest: Add framework platform abstraction shim
Charles Giessen [Fri, 23 Apr 2021 17:53:53 +0000 (11:53 -0600)]
test: Add framework platform abstraction shim

The loader queries various platform systems for info such as the
location of ICDs and layers. To isolate the loader during testing
from the system it is running on, the platform shim intercepts the
necessary functions so that the contents of the systems queried by
the loader can be configured by tests.

On windows this involves 2 aspects:
Detouring Win32 API functions and redirecting the registry.
The `Detours` library is used to easily capture Win32 API calls.
And the registry uses `RegOverridePredefKey` to redirect the registry
entries the loader accesses.

On linux this only involves intercepting 3 functions; `opendir`,
`access`, and `fopen`. This allows the framework to tell the loader
what to actuall open/access/fopen. These interceptions call the
underlying function but with altered arguments, specifically to
paths the tests set up.

Change-Id: I3531a1cb190c489ffd9f1f0549d0ebcacb3818c5

3 years agotests: Add TestICD for mocking ICD's
Charles Giessen [Fri, 23 Apr 2021 17:51:54 +0000 (11:51 -0600)]
tests: Add TestICD for mocking ICD's

The TestICD is a configurable ICD which can recreate much of the
behavior the loader expects of an ICD. Combined with a direct line
of communication between the tests and TestICD, tests can setup
specific conditions that have a known response from the loader,
thus allowing proper regression testing.

Change-Id: I84303f0ddb6011fc1b76dad25fd249abb2da29c9

3 years agotest: Add framework cmake and utilities
Charles Giessen [Fri, 23 Apr 2021 17:49:09 +0000 (11:49 -0600)]
test: Add framework cmake and utilities

Create the CMake infrastructure for a testing framework.
`test_util.h/.cpp` contains the core macros, wrappers, and utilities.
framework_config.h.in is the header that other components include
to get the full path to binaries on a system.

Change-Id: I3e24a3ee4ff24da499a3bca63059e3b872d3981c

3 years agocmake: Make loader use same CRT in debug mode
Charles Giessen [Sat, 6 Mar 2021 00:12:24 +0000 (16:12 -0800)]
cmake: Make loader use same CRT in debug mode

This solves the issue of debug asserts appearing in the output due to
mixed CRT's in the same build.

Change-Id: I06169c143614dd1102c901f57aa4bdf431df8846

3 years agobuild: Update to header 1.2.179 upstream/1.2.179 upstream/v1.2.179
Mike Schuchardt [Mon, 24 May 2021 15:17:34 +0000 (09:17 -0600)]
build: Update to header 1.2.179

- Update known-good
- Generate source (no change)

Change-Id: Ib52dc0ff04f76fd1db2dea4a125a094d30abab62

3 years agobuild: Update to header 1.2.178
Mike Schuchardt [Tue, 11 May 2021 18:36:30 +0000 (11:36 -0700)]
build: Update to header 1.2.178

- Update known-good
- Generate source

Change-Id: I3e2756d9dc0452cc3743a05840d8e2a76961406a

3 years agoloader: Emit DEBUG for unknown function names
Charles Giessen [Tue, 4 May 2021 22:06:04 +0000 (16:06 -0600)]
loader: Emit DEBUG for unknown function names

Loader previously emitted WARN level log messages for unknown
function names. This isn't wrong behavior and is mainly useful to
loader developers. Many layers and applications try to load all
function pointers they know about, so this code path is well
travelled.

Change-Id: Ia3e4b47eddb36bd02bcbab8452e5a96d03f75bd3