Commit Graph

154 Commits

Author SHA1 Message Date
andrew0229 3f7fe7b7b4 update to v1.3.275
Signed-off-by: andrew0229 <zhangzhao62@huawei.com>
Change-Id: Ifc4224db2c6ea7c159d3cabe8f075475d47a41a8
2024-05-21 08:09:09 +00:00
Charles Giessen f0fc8cf491 Guard loader.instances access with mutex.
While the adding and removing of data from this global linked list
was guarded, GetInstanceProcAddr & GetDeviceProcAddr did not have
such guards. This results in race conditions that were detected with
thread sanitizer. This commit adds a mutex solely for the
loader.instances global variable.
2022-10-12 10:48:16 -06:00
Charles Giessen 7f10040d01 Remove unneeded exports in test_wrap_layers
Some functions in the wrapping test layer exported functions that are not necessary.
This caused some warnings in builds. Removing them fixes the warnings.
2022-09-01 13:13:14 -06:00
Charles Giessen f9d0e0d0f3 Refactor unknown function tests
Allow multiple layers to intercept an unknown function and then create a single test
which tests many common combinations.
2022-09-01 12:23:17 -06:00
Brad Smith f3cce0e816 tests: Further fixes to be able to build on OpenBSD 2022-09-01 12:21:19 -06:00
Brad Smith 2d04b71e5c loader: Add stub function for OpenBSD executable path 2022-08-31 14:11:59 -06:00
Charles Giessen 52ba0949c8 Dont pass portability bit to ICDs that dont expect it
There was a small issue with the initial version of the portability
enumeration extension where the portability enumeration flag bit would
be passed down to ICDs which did not expect flags to contain anything
other than zero.

While an argument could be made for those drivers to ignore flags they
do not recognize, just like extensions and other 'unknown' things, it
is best to play nice as this is the first instance creation flag bit
added.
2022-08-31 11:49:56 -06:00
Brad Smith 643e51844c loader: Add OpenBSD support 2022-08-31 10:02:13 -06:00
Jesse Natalie 62efb88939 Enable the Vulkan loader to load VulkanOn12/Dozen out of the D3DMappingLayers app package 2022-07-05 14:34:53 -06:00
Charles Giessen 3abfdb2f2d Make tests get files in a consistent order
Use the order defined the FolderManager's to define the order readdir
uses, rather than leaving it undetermined. This makes tests more consistent
by forcing layers and drivers to always be found in the same order on all
systems.

Note: MacOS doesn't currently have consistent ordering due to a crash with
ASAN. But even if ASAN isn't running, the dirent structure is being filled
out incorrectly, causing further test failures. While not ideal to disable
consistent ordering on MacOS, it is needed for linux and thus the issue
isn't high enough priority to resolve.
2022-07-01 13:36:27 -06:00
Andrew Naumov 697f1801c5 loader: Add unicode support 2022-06-24 13:14:10 -06:00
Charles Giessen 0dbe5db838 Add 32 & 64 bit field to json manifests
Allows drivers and layers to specify if they are 32 bit or 64 bit in the
manifest file. This makes the loader able to prune manifests without
loading the library and finding that it failed to load.
2022-06-22 10:28:18 -06:00
Mike Schuchardt 637329a14e build: Update to header 1.3.218
- Update known-good
- Generate source
- Add missing enums to test framework
2022-06-16 13:35:17 -07:00
Charles Giessen 565ff9668a Only check first GPDPA in the layer chain.
When checking for unknown physical device functions, check the first layer that supports
vk_layerGetPhysicalDeviceProcAddr in the chain starting with the layer closest to the
application. This prevents unecessary work being done, and if any layer wraps VkInstance
will properly call through the wrapping layer first without calling into any other layer.
2022-06-06 21:34:36 -06:00
Charles Giessen c129609717 Fix crashes from OOM in vkDestroyInstance
Various situations could cause an OOM to turn into a hard crash due to double freeing
of memory that was improperly cleaned up. Also fixed memory leaks when layers would
report OOM.
2022-05-27 17:25:52 -06:00
Mike Schuchardt a43773fae1 build: Update to header 1.3.213
- Update known-good
- Generate source
2022-05-11 10:31:02 -07:00
Charles Giessen 711031a24a Revert "Implement unknown function intercept in layers"
This reverts commit fc845625ed.
2022-05-11 08:57:30 -06:00
Charles Giessen fc845625ed Implement unknown function intercept in layers
Make it possible for layers to declare that they support unknown functions
and set up the layer dispatch table appropriately. A very niche use case
but helpful when developing validation for functions not yet out in the
public headers.
2022-05-03 17:38:09 -06:00
Charles Giessen 04cb622abe Add app_key OverrideMetaLayer tests 2022-04-14 13:18:54 -06:00
Charles Giessen c8713e1fbe Refactor FrameworkEnvironment API a bit
Redo some of API's for adding layers and ICD's to the test framework.
2022-04-12 13:00:32 -06:00
Charles Giessen ec37453641 Warn if portability_enumeration extension should be enabled
Log an error if an application creates a VkDevice from a physical device which
was enumerated from a driver that is a portability driver but the application
didn't correctly enable the portability enumeration flag & extension.
2022-04-06 18:25:09 -06:00
Charles Giessen e23d3208d3 Use correct TestICD in tests
Many tests were using the V6 TestICD, which means that it exports the
EnumerateAdapterPhysicalDevices. The loader then only looks for devices
using that functionality and if the test didn't set it up, the driver
won't have its devices found.

Also:
* Cleaned up handle_validation_tests
* Added WSI setup helpers, which put all the setup code for WSI in one place
* Created a to/from_nondispatch_handle function for TestICD, probably should
be in a more general location
2022-04-04 16:38:17 -06:00
Charles Giessen b8bc04cebd Dont emit warnings on unknown manifest file versions
Since the loader is meant to be forward compatible, it makes little sense to emit
a warning when an ICD or Layer manifest is found with a version that it doesn't
understand. Thus they now are INFO level.
2022-03-31 11:54:03 -06:00
unknown 36567bdade Fixup several small issues found by Visual Studio
The VS Analyzer went through the codebase and pointed out a dozen warnings and
one possible crash.
2022-03-30 10:06:23 -06:00
Charles Giessen c5c8d7296b Enable /W4 errors and support clang-cl
Enable /W4 errors on MSVC and fix all corresponding errors.

Refactor the CMakeLists.txt to allow for compiling with clang-cl. This required
figuring out that -Wall -Wextra mangle the set of warnings used. The solution
is to use /W4 instead when compiling with clang-cl on Windows.
2022-03-29 16:10:30 -06:00
Mark Young 768baf2cf7 Apply code review comments from @charles-lunarg 2022-03-25 15:29:40 -06:00
Mark Young bb19d51b3c Fix #888 crash in Lutris with Linux sorting
The sorting algorithm needed to take into account both the application
API version as well as the driver API version.

This required additional changes to the sorting algorithm for the fallback
since even if the instance supports the extension or Vulkan 1.1, the individual
drivers may not.

Also, add supporting tests which would catch these cases in the future.
In the process, I realized we assumed that the presence of an extension in the
test_icd indicated "enablement" which was incorrect.  So I separated out
that into a set of "enabled instance extensions"
2022-03-25 15:29:40 -06:00
Charles Giessen 9ef85c237b Fixup windows test infrastructure
Cleaned up several bugs in the testing framework in the windows shim.
Rewrote the tests that exercise DXGI/D3DKMT functionality.
2022-03-24 19:00:28 -06:00
Mark Young 1f54c8d711 Fix non-sorted surface indexing
The physical device terminator was missing the ICD index in the
non-sorted path.  This caused crashes in Angle before it was realized
that the sorting code was unintentionally disabled in that build
path.

Also, add tests to catch this case in the future in the WSI code, but
this required converting all the TEST_F tests to TEST since Gtest
didn't like mixing the 2 on my system.

Finally, fix a few WSI error messages in the loader which were
missing spaces.

Fixes #863 for non-sorting paths
2022-03-24 15:22:04 -06:00
Charles Giessen 0bc6454e6b Tests close layer handles when necessary
The fs::FolderManager can't close objects that are in use, thus if the tests
keep open a binary then the destructor will fail to delete the file. This
commit manually cleans out the FrameworkEnvironment's loaded layers to prevent
this from happening.
2022-03-14 23:31:26 -06:00
Charles Giessen e0e083147e Test framework now shims registry functions
Previously the way the test framework worked was to fake the registry using a
special windows API call. However this led to brittle tests and was incompatible
with googletest's death test capabilities.

These death tests highlighted that the current set of them didn't use the built in
matcher to verify a correct crash/abort. This commit also amends all uses of
ASSERT_DEATH to provide the relevant death message.

If a driver reports an interface version greater than 0 but doesn't export
vk_icdGetInstanceProcAddr, the loader will now skip the driver.
2022-03-14 23:31:26 -06:00
Charles Giessen dec1fcac60 Remove hasing of unknown functions
Use a simple linear search instead. This greatly simplifies the logic and
reduces the places for the logic to go awry.
2022-03-14 23:31:26 -06:00
Charles Giessen 81308d62c1 Revamp unknown function tests
Make use of multiple different functions that are used so that its more
obvious when a test is actually calling the right function.
2022-03-14 23:31:26 -06:00
Charles Giessen 71f81bd9b0 Remove VK_NO_PROTOTYPES from test_util.h 2022-03-09 16:02:22 -07:00
Charles Giessen 528ae5c2a9 make secure_getenv discovery project wide
Since the tests need to know if secure_getenv exists or not, the detection and
setup logic is now in the top level CMakeLists.txt.
2022-03-09 15:06:30 -07:00
Charles Giessen e2b3b9def3 Set VK_NO_PROTOTYPES on test targets
Moves the definition of VK_NO_PROTOTYPES out of a header and into cmake so that
so that libraries and executables can set or not set it if they so desire. This
allows binaries to link directly to the loader if need be.
2022-03-09 15:06:30 -07:00
Charles Giessen 1c30270eee Fix tests compiler warnings from bool conversions
While set_env_var did return a boolean, this caused odd performance warnings
on old compilers and wasn't being used by the tests.
2022-03-09 15:06:30 -07:00
Charles Giessen 0659845033 Refactor CMake to user correct C/C++ Standard
Make sure the correct C++ version but also refactor the tests CMake code
to clean it up.
2022-03-09 15:06:30 -07:00
Charles Giessen 1c4c28eb9d Set CMake C & C++ standard per target 2022-03-09 15:06:30 -07:00
Charles Giessen 2db90ac102 Specify wrap_objects.cpp in CMake code
While CMake will append appropriate file extensions when the full name isn't
given, such as "wrap_objects", it is best to specify the file with its
extension for explicitness.
2022-03-09 15:06:30 -07:00
Charles Giessen 664be18bef Cleanup MSVC CMake code
* Googletest has been updated to 1.11 which means the TR1 deprecation notice is
unecessary.

* The `/permissive-` flag has been moved to loader_common_options so it doesn't
have to be repeated over and over.

* Since we do not support VS 2013 and early, use /guard:cf everywhere

* Remove MSVC_LOADER_COMPILE_OPTIONS in favor of loader_common_options

* Remove reduntant compile options and include directories
2022-03-09 15:06:30 -07:00
Charles Giessen a3b25b43c5 Refactor CMake WSI platform defines
Move the WSI macro defines into their own target such that it can be shared
with the loader and test code. Note that this commit is a part of a series
and not intended to work standalone.
2022-03-09 15:06:30 -07:00
Mark Young 88c33c9e63 Changes to additive env var based on code review 2022-03-04 15:38:46 -07:00
Mark Young 5cfef22afe Fix WIndows elevation 2022-03-04 15:38:46 -07:00
Mark Young 759d5b4c94 Add "additive" environment variables
Add "additive" environment variables for adding additional layer
paths or driver JSON files instead of replacing default ones.

Also, rename VK_ICD_FILENAMES to VK_DRIVER_FILES since we're trying
to remove references to ICDs because software driver implementations
of Vulkan aren't ICDs (but continue to support the old name as well).

Added documentation around these changes to reflect the new name and
the new variables.
2022-03-04 15:38:46 -07:00
Mark Young 78bb5abd97 Resolve Angle failure because it breaks with is_high_integrity
Angle drops the security enforcement of the loader on environment
variables and the additional "is_high_integrity" checks on my
previous loader change caused failures in the Angle run.
Revert the high-integrity checks and update the layer test to
work properly.
2022-02-28 12:06:57 -07:00
Mark Young 054dd03d45 Enable testing of high-integrity in the loader
Enable testing to check if the loader is running with elevated
privileges.  This is to make sure we're ignoring the appropriate
environment variables in those scenarios to potentially avoid
escalation exploits.
2022-02-17 11:37:30 -07:00
Mark Young ef91b4821f Clean up layer test
My previous commit to enable physical device modifications in a layer
required new compiled layers to do the work.  Since this can more
cleanly be done by setting layer flags (as suggested by @charles-lunarg)
I have gone back and done that.
2022-02-16 10:09:29 -07:00
Mark Young 2cac2efc06 Fix Windows build and add proper phys dev group sorting 2022-02-16 08:29:42 -07:00
Mark Young 63db6aa605 Code review comment fixes.
Also, cleaned up Linux vs Windows code so that there was less duplication and
complexity.
2022-02-16 08:29:42 -07:00