Commit Graph

798 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
andrew0229 d1b02da7f2 1.add new floder for swapchian layer;2.disable dlcolse;3.enable env
Signed-off-by: andrew0229 <zhangzhao62@huawei.com>
Change-Id: I378fac2b692ad8520d525288c0a8a60ada6e5c0f
2024-04-18 13:00:32 +00:00
shegangbin 5985354d40 standardize OH extension api
Signed-off-by: shegangbin <shegangbin1@huawei.com>
Change-Id: I854a1a67f1337482279c300dcc37f6637c638f7e
2023-06-19 11:42:13 +08:00
Charles Giessen 44b3ec70f3 Correctly handle layers not being loaded in vkCreateDevice
This reverts the previous commit which reverted bad behavior.
2022-10-12 18:58:46 -06:00
Charles Giessen d5c31481c8 Revert "Don't load layer libraries in vkCreateDevice"
This reverts commit 6272df7dc3.
2022-10-12 16:22:24 -06: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 6272df7dc3 Don't load layer libraries in vkCreateDevice
These libraries will always be loaded in vkCreateInstance, so we don't
need to load them again in vkCreateDevice. This has the added benefit
of not printing 'unloading library X' twice in the log.
2022-10-04 13:28:00 -06:00
Charles Giessen c9d287574b Make old layer with new app API version warning clearer
The previous message incorrectly labled all layes as Explicit layers
and didn't indicate what the 'warning' was about very well.
2022-09-15 10:03:20 -06:00
Charles Giessen 8623a30ef7 Allow implicit layers for all API versions
This change makes the loader conform to the latests specification
update, 1.3.227, which removes the requirement that implicit layers
API version is at least as high as the application provided API
version.

This change reduces friction for layer developers and API users.
2022-09-08 13:48:46 -06:00
Charles Giessen 735f1d45a3 Refactor loader_icd_scan()
Put all of the parsing for ICD Manifest data into a separate function.
This cleans it up by not requiring manual tracking of allocated resources
while parsing, and allow much saner 'skipping' of incorrect ICD's.

This commit also addresses an issue where OOM during ICD parsing wasn't
immediately ending parsing and returning.
2022-09-01 13:13:14 -06:00
Charles Giessen 6c57cd22bd Remove redundant checks for NULL
Calling free() doesn't require checking for NULL, but many places were
checking for NULL before calling the appropriate freeing function.
2022-09-01 13:13:14 -06:00
Charles Giessen 5de034c96f Enable layer interception of unknown functions
Re-add previously reverted behavior that allows layers to setup dispatch chains for unknown physical
device and device functions during vkCreateInstance. Previously, functions not known to the loader could not
be queried by a layer during vkCreateInstance (when dispatch tables should be setup). The change adds support
for unknown functions in the trampolines of vkGetInstanceProcAddr and vkGetPhysicalDeviceProcAddr.

Unknown Device functions not listed in a layers manifest will now be found through vkGetInstanceProcAddr,
which was previously not used.
2022-09-01 12:23:17 -06:00
Charles Giessen 643ca68d77 Rename GIPA, GPDPA, & GDPA terminators
Use more correct terminology for the various terminators of the
get proc addr functions. This makes it more obvious when each function
is being called, as well as removing the unecessary
loader_gpdpa_instance_internal.
2022-09-01 12:23:17 -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
Charles Giessen 20a7763ead Separate Major.minor version checks from Full version checks
loader_make_Version previously would decode the major, minor, and patch info out of version data. This results in
erroneous version checks that took into account patch version when they shouldn't of. The loader_make_full_version
function is introduced for code that wishes to get the full major.minor.patch version and uses of
loader_make_version that need the full version have been replaced.
2022-08-15 09:27:43 -06:00
Charles Giessen daafcbc324 Use memmove for copying pApplicationInfo
Replace memcpy with memmove in terminator_CreateInstance to prevent possible issues
with the same memory being the source of the copy and the dest, as there is a for
loop which makes it possible for that to happen.
2022-07-29 16:09:29 -06:00
Mike Schuchardt 9021a6f1fa loader: Dynamically load Win8+ functions
Allow loader to run on Windows 7 by dynamically loading function
pointers for Windows 8 and above APIs.
2022-07-11 13:38:35 -06:00
Charles Giessen 1ba0884ecf Disable VulkanOn12/Dozen in Windows 7
Chromium still supports building for Win7, as such the newly added support for
VulkanOn12/Dozen needs to be excluded from said build. This is achieved by using
the SDK version macros defined in <sdkddkver>
2022-07-08 13:32:14 -06:00
Charles Giessen 8c34a62d0b Fix corrupted pNext chain in vkCreateDevice
When creating a device, the loader looks for the VkDeviceGroupCreateInfo
structure and replaces it with its own. This allows the loader to edit the
struct. However, to do this required editing the pNext chain. Because the
edited chain contained pointers to structures whose lifetimes end when the
vkCreateDevice function returns, the pNext chain is now corrupted.

This commit fixes that by storing a pointer to the user's
VkDeviceGroupCreateInfo and fixing up the pNext chain to use that instead.
2022-07-07 18:17:34 -06:00
Charles Giessen cd85dc6c3f Refactor vk_loader_platform.h
Move includes of vulkan headers into loader_common.h, delete dead code
and unnecessary macro defines, and generally clean up the header.
2022-07-07 14:41:01 -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
Marcin Kańtoch 1c84e3b5c2 loader: device array dealloc fix 2022-06-24 14:08:04 -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
Charles Giessen 90dbb56eec Fix use-after-free in loader_add_layer_properties
Occurs after file_vers is freed and when the layer manifest has a layers field
but has a version of 1.0.0.
2022-06-22 10:18:15 -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
Charles Giessen 4f6ccc2f2f Keep allocated debug callbacks until destroy instance
Previously the loader would destroy any debug callbacks created during instance creation
to later create new ones during instance destruction. This required a memory allocation
to occur inside vkDestroyInstance, which can cause leaks if an OOM occurs during
instance destruction.

This commit simplifies the logic by keeping around the allocations made during instance
creation by moving them into their own debug node chain. Then during instance destruction
moves them back.

Also renames several functions to better describe their intended purpose.
2022-05-27 17:14:25 -06:00
Charles Giessen a3d18efea0 Use calloc to allocate memory for the search path
This prevents bugs where uninitialized memory is treated as a real path. It
should fix an issue where sometimes CI would fail due to what appears to be a
spurious path with junk characters.
2022-05-27 11:12:46 -06:00
Charles Giessen 33f0d2f61c Fix a NULL inst crashing during loader_icd_scan
When checking for the portability driver field of driver manifests,
the loader did not check if inst was NULL first. Since this function
is called in pre-instance functions, this crashes the loader.
2022-05-25 13:14:04 -06:00
Charles Giessen 01b3ae769f Use calloc instead of alloc+memset
Replace naked uses of malloc & free with loader_alloc & loader_free.
2022-05-24 14:18:26 -06:00
Charles Giessen e87a34cc6e Use VkAllocationCallback in cJSON
Make cJSON pass the VkAllocationCallbacks instead of the loader_instance.
This removes and unecessary dependency between cJSON and the loader headers.
It also somewhat simplifies the interface by not requiring the inst parameter
everywhere, just in the creation of cJSON pointers and freeing.
2022-05-24 14:18:26 -06:00
Charles Giessen 40e0ee3792 Use VkAllocationCallbacks in windows dirent
Pass the allocation callbacks directly to dirent_on_windows.
This removes a unecessary dependency between the loader headers and
dirent_on_windows.
2022-05-24 14:18:26 -06:00
Charles Giessen c947827900 Refactor loader allocation functionality
Created wrapper functions loader_alloc, loader_calloc, loader_free,
and loader_realloc. Made the existing loader allocation functions use
them. Replaced manual usage of VkAllocatorCallbacks with the new
wrapper functions.
2022-05-24 14:18:26 -06:00
Charles Giessen 711031a24a Revert "Implement unknown function intercept in layers"
This reverts commit fc845625ed.
2022-05-11 08:57:30 -06:00
Mark Young c00ad5835c Output message if override app_keys mismatch on app name
Output a layer message if the override layer is present and the
app name is not in the app_keys list.
Fixes issue #917.
2022-05-05 16:46:41 -06:00
Charles Giessen 1dbe2ea63f Make portability drivers not load by default
Unless the portability enumeration extension is enabled and the create instance flags
contain VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR, do not enumerate drivers that
contain `is_portability_driver` in their JSON Manifest. This is phase 2 of the release
for the VK_KHR_portability_enumeration extension.

An error message will be printed when no drivers were reported but there was a
portability driver which was skipped over.
2022-05-04 15:40:27 -06:00
Charles Giessen 57e6b0cd0b Fix CMake code for getting Git Version information
The ${CMAKE_SOURCE_DIR} uses the wrong directory when the loader is included as a
subproject. By using ${CMAKE_CURRENT_LIST_DIR}, the CMake code to find the git
commit and branch name will use the correct directory.

Additionally, the logic was ammended to curtail this issue in the future. Quotes are
included in the string to allow it to be used as a string literal, instead of
needing a const char[] variable and macros. Also, the CMake code was restructured
to always define GIT_BRANCH_NAME and GIT_TAG_INFO.
2022-05-04 14:46:53 -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 01cac032ad Document VK_KHR_portability_enumeration support 2022-04-07 11:49:53 -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 a9c65f6fe5 Allow meta layers to have newer component layers
Relax the requirement that all component layers in a meta layer must equal the version of the meta layer.
This allows enabling layers that do not have the same API version as the meta layer.
2022-04-04 19:17:07 -06:00
Charles Giessen 4300734bf2 Clean up version checking logic
Add a few helper functions to simplify checking that a X.Y.Z version is sufficient.
2022-04-04 19:17:07 -06:00
Charles Giessen 082bf4913a Fix missed Physical Devices in Windows
The previous logic would cause any non-sorted physical devices to be missed
when aggregating the final list. This caused crashes due to the phys_dev
value not being initialized. The fix is to make sure both sorted and non
sorted physical devices are included in the final output of
setup_loader_term_phys_devs().
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 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 81118f48e8 Remove LDP_DRIVER_6
The cause for this policy was due to dynamic linker behavior which could have
resulted in the wrong symbols being used. However, this didn't occur in
practical usage of the dynamic linker. Also drivers exporting Vulkan
entrypoints was a useful behavior to enable testing and more flexible usage
that this policy actively interfered with.
2022-03-25 11:52:46 -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
Mark Young 1a7f3b986d Add device log info on vkCreateDevice
To make things clearer on output, log the device information for
the physical device being used on vkCreateDevice if either the
layer or the driver log bits are set.
2022-03-21 14:04:39 -06:00