Commit Graph

113 Commits

Author SHA1 Message Date
andrew0229
0281b281d0 update to v1.3.275
Signed-off-by: andrew0229 <zhangzhao62@huawei.com>
Change-Id: Ifc4224db2c6ea7c159d3cabe8f075475d47a41a8
2024-05-21 08:09:09 +00:00
andrew0229
b704218cf0 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
Brad Smith
095a7bf60b loader: Add stub function for OpenBSD executable path 2022-08-31 14:11:59 -06:00
Brad Smith
c745281f0f loader: Add OpenBSD support 2022-08-31 10:02:13 -06:00
Charles Giessen
0c7685be41 Initialize properly when statically linked
Previously, the loader supported static linking. This capability was restricted
to MacOS only, however the necessary functionality was never implemented. This
commit adds the required code to properly initialize the loader when statically
linked with MacOS

Since the test framework was designed to dynamically load everything, it would
require significant rearchitecting to support it. As such, a simple verification
executable was added to the live_verification folder, instead of full support
in the test framework.
2022-07-07 14:41:01 -06:00
Charles Giessen
d8af0ae227 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
Andrew Naumov
5249c8f869 loader: Add unicode support 2022-06-24 13:14:10 -06:00
Charles Giessen
e65a8bcaeb 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
a06dd5484a 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
336508b06b 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
46abc7dc4e 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
be7c48c0e9 loader log error if a requested layer not loaded
This should throw an error message if a requested layer didn't load.
This could happen if the JSON file is present, but only a library
exists on the system for the wrong target (like 32 vs 64-bit).

If it did fail because of being the wrong bit-type, we report an info
message only, unless it was directly requested by the application.

Modify the improper bit-depth layer loading test so that it is now 4
tests:
 - Verify bad explicit layer generates VK_ERROR_LAYER_NOT_PRESENT error
 - Verify bad implicit layer generates only an info in the loader output
 - Test case with both a bad implicit and explicit layer with INFO logging
   we should see both messages.
 - Test case with both a bad implicit and explicit layer with ERROR logging
   we should see only the explicit failure message.

Report info failure for ICD wrong bit-type as well.

Finally, fixed a small compilation warning for disabled code.
2022-01-31 14:35:07 -07:00
Eleni Maria Stea
77f3ea476e loader, asm_offset: define BSD_VISIBLE and fix ifdef bug
In vk_loader_platform.h there was a leftover #if defined (__FreeBSD__)
... elif #defined(__FreeBSD__) that needed fixing. After that it was
necessary to define BSD_VISIBLE before including <sys/types.h> required
by <sys/sysctl.h> required by asm_offset and loader CMakeLists.txt had
to be  modified accordingly.
2021-11-04 09:47:34 -06:00
Eleni Maria Stea
b35527922c loader: include FreeBSD in supported platforms
Added FreeBSD in supported platforms in vk_loader_platform.h, and tests,
defined BSD_VISIBLE and included some necessary header files for
Vulkan-Loader to compile on FreeBSD.

v2: did the same in loader/loader.c (Charles Giessen)
v3: did the same in the tests (Charles Giessen)
v4: applied this downstream patch from Jan Beich because there's no /proc
on FreeBSD: 7caf52e37b/graphics/vulkan-loader/files/patch-loader_vk__loader__platform.h (Jan Beich)
v4: rebased to master and modified tests/loader_regression_tests.cpp,
tests/loader_testing_main.cpp
v5: moved the definition of __BSD_VISIBLE 1 (required for alloca to
work) in CMakeLists.txt from header files (Charles Giessen)
v6: replaced ${CMAKE_SYSTEM_NAME} with CMAKE_SYSTEM_NAME in
loader/CMakeLists.txt to match the style of previous checks (Jan Beich)
v7: replaced add_compile_definitions with target_compile_definitions to
prevent the macro from being applied unnecessarily (Charles Giessen)
2021-10-20 10:29:26 -06:00
Charles Giessen
4799c294d6 loader: Header include cleanup
Separated headers into common groups, with system headers being first, then
Vulkan API headers, followed by loader headers.

Then alphabetized headers in each group. Due to moving _GNU_SOURCE to being set
by cmake, there isn't any implicit dependency between the include order used.

Made sure headers should be able to be included independently, such as
including the vulkan headers where appropriate.
2021-09-09 11:28:56 -06:00
Charles Giessen
0530f8cb35 loader: Make _GNU_SOURCE a cmake definition
Moves the many instances of #define _GNU_SOURCE into a single cmake call which
sets the macro in all translation units for the vulkan library. This way it
cannot be forgotten and makes behavior across the library consistent.
2021-09-09 11:28:56 -06:00
Charles Giessen
e13e2f51cb loader: Move alloca into allocation.h 2021-09-09 11:28:56 -06:00
Charles Giessen
439b453d10 loader: Shift around vk_loader_platform headers
Moved the includes into their own block, instead of living in the block for
each operating system. This way is easier to see what includes are in the file
in its entirety.

Also, _GNU_SOURCE was uncommented since it appears in each source file
individually and is needed for alloca and secure_getenv
2021-09-09 11:28:56 -06:00
Charles Giessen
055d1dd45e loader: Dont include C++ libraries in C++ mode 2021-09-09 11:28:56 -06:00
Charles Giessen
903a17df86 loader: Remove TLS
The only purpose TLS was serving was as a channel for allocation callbacks to
be useable inside cJSON and dirent_on_windows. TLS didn't solve any specific
threading problem. Instead it served as an information channel. On top of that,
the only time when the TLS was used was inside vkCreateInstance as the
pre-instance calls would have the TLS pointer to loader_instance be set to
NULL.
2021-09-09 11:28:56 -06:00
Charles Giessen
7d46bb6db9 loader: Update Copyright for 2021 2021-09-09 11:28:56 -06:00
Charles Giessen
52859e7695 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.
2021-08-11 15:16:56 -06:00
Mike Gorchak
684c2a6873 Add support for QNX platform. 2021-04-06 14:52:51 -06:00
Craig Stout
f8a8762459 Add Fuchsia support
Fuchsia (fuchsia.dev) builds with GN and uses a loader service to load
the ICD into the application's address space.

ANGLE builds have been verified.
Reemoves unused variable is_icd.
2020-10-19 10:12:32 -06:00
Lenny Komow
09358b3270 loader: Remove RTLD_DEEPBIND flag
This causes trouble when used with the steam fossilize layer. We'd
still like to use RTLD_DEEPBIND, but we need to work out the issues
first.

Change-Id: Ic44b5a9de9a4e7a1163cbc68e4d5e692315b285c
2020-07-14 13:54:05 -06:00
Charles Giessen
d704d1bc0e loader: Make RTLD_DEEPBIND conditional on ASAN
Address Sanitizer (ASAN) is broken by the inclusion of RTLD_DEEPBIND. This commit
removes that dlopen flag if ASAN is detected during compilation.

Change-Id: Ibc3cc329b2f6335a3d5982691b6491efc8c3bbe9
2020-07-10 10:22:57 -06:00
Alexander Batashev
4c6019a855 loader: Fix symbol lookup order
Some Vulkan implementations may rely on external libraries.
One example is mesa driver, that uses libLLVM.so. If user
application also links with LLVM, some clashes may take place.
This patch ensures that library's own symbols are looked up
before any other symbols in current process.
2020-07-06 17:02:12 -06:00
Charles Giessen
ead2b57f2e loader: add per-application override layer settings
An array of strings was added to the override layer to provide
per-application overrides. The loader will now look for an override profile
which contains an app_key entry that matches the path & name of the currently
running executable. Previous behavior with a global override still works as
intended.

This changes is in conjunction with the VkConfig rewrite to allow for more
than one override profile to be enabled.

Changes to be committed:
	modified:   loader/loader.c
	modified:   loader/loader.h
	modified:   loader/vk_loader_platform.h

Change-Id: I9ddbc98a098d48064110db6c29998eddb336fcda
2020-05-26 09:52:38 -06:00
Charles Giessen
44ac9b2f40 Fix spelling mistakes
Several comments and one error message contained spelling mistakes.
This commit fixes it.

Changes to be committed:
	modified:   loader/loader.c
	modified:   loader/vk_loader_platform.h

Change-Id: Ida86de154b1c1e80c1d251ce71246a06ab038e2d
2020-01-27 17:44:44 -07:00
Charles Giessen
a0099c5028 loader: Remove loader_platform_basename dead code
The loader_platform_basename function is not being used anywhere
else and was last modified 4 years ago. Considering the amount of
TODO comments and mentions to replace this, there doesn't seem
like a pressing need to keep it.

Changes to be committed:
	modified:   loader/vk_loader_platform.h

Change-Id: Icd7a4d1104889e0519081831fbfaaaa46690438c
2020-01-13 13:54:40 -07:00
Lenny Komow
08d344208e loader: Remove code for building a static loader
Change-Id: Id795e795a52ace1bf3c0c0fdbc5aed19d05bef01
2019-11-21 16:50:59 -07:00
Rémi Verschelde
d595f54875 loader: Make Windows includes lowercase for MinGW
MinGW-w64 ships all Windows SDK headers as lowercase, which prevents
cross-compiling this code from Linux.

Windows filesystems are case insensitive so it should work fine with
lowercase includes.
2019-08-08 15:04:14 -06:00
Alexey Kryshen
ab2bcb97c7 loader: Fix MinGW compilation
Change-Id: I2a80ed83b0431be07cb6f992f4c8742a86aca294
2019-07-22 17:08:17 -06:00
Lenny Komow
6eb61431a4 loader: Get ICDs by calling enum adapter function
Change-Id: I5faa4e78ec1e445122ed7d640cc296c33d8a7aa4
2019-07-10 11:59:25 -06:00
Lenny Komow
40761b0913 loader: Override layer support and settings
Add support for an override layer in the loader. This allows layers
to be set by an outside application.

Revamp the logic to detect manifest files in the various paths that
we allow them to be placed. This code significantly rewrites
loader_get_manifest_files.

Change-Id: I8abf558864b66eb71ee026ca559b0126cf2fa4e9
2018-10-22 16:33:51 -06:00
Tom Anderson
a8358804f3 Fix build with CFLAGS="-std=c11 -D_GNU_SOURCE" 2018-07-26 10:25:32 -06:00
Karl Schultz
d81ebfb75a macOS: Add macOS support 2018-03-02 12:21:19 -07:00
Nico Weber
d3e53e9328 build: Fix -Wmicrosoft-cast warnings with clang-cl
MSVC allows implicit conversion from function pointers to void*.
The C++ standard doesn't allow this, and clang-cl emits a warning
when this is done.  This change fixes these warnings in
Vulkan-LoaderAndValidationLayers.

Arguably, loader_platform_get_proc_address() should return a
FARPROC so that the compiler can help checking calling conventions,
but this is the simplest fix that unblocks us.

This is needed for https://crbug.com/550065
2018-03-02 09:40:13 -07:00
Slawomir Cygan
fe80c2a1c1 loader: remove references to shlwapi.lib
This change improves loader compatibility with Universal
Windows drivers[1]: shlwapi.lib is not a part of allowed APIs.

It seems PathFileExists call was already redundant as
ERROR_MOD_NOT_FOUND was already returned by the loader in
cse of wrong dll path.

PathIsRelative is replaced by equivalent check.

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/getting-started-with-universal-drivers

Change-Id: I36854f38078670ac033e8bd415dbf368391e8448
2018-02-12 13:23:57 -07:00
Lenny Komow
3f14edc587 loader: Fix static library initialization
Fix the loader's global initialization being skipped when the loader
is built as a static library on windows

Change-Id: I492f87104fb3bf32aed3c7d251dee2caeb4f00ba
2018-01-19 16:44:17 -07:00
Lenny Komow
8f53429c27 loader: Fix enabling extensions from layers
This resolves a bug where it was impossible to enable an extension
that was defined in a layer if that layer was not passed by the
application. This applied to implicit layers, explicit layers enabled
by environment variables, and metalayers.

Change-Id: I03bee6fb778936d970f78b9142679654424f80ae
2018-01-18 16:06:06 -07:00
Lenny Komow
1ea2946b88 loader: Clean up mutexes on destruction
Change-Id: I7d1524da9167a576420c109ebbce8ebb5121cad0
2018-01-16 15:49:54 -07:00
Jamie Madill
fb072937ef loader: Fix Clang errors/warnings.
Fixes:

format specifies type 'int' but the argument has type 'DWORD' (aka 'unsigned long') [-Werror,-Wformat]
error : expected ')' (issue with __FUNCTION__ and format string)
2017-12-04 13:24:39 -07:00
Lenny Komow
db1e6190b0 loader: Allow layer loading from pnp registry
Change-Id: I70682cf5904b95b52881457e14bbc2f9a772259d
2017-09-06 11:54:17 -06:00
Lenny Komow
2ba594b7b8 loader: Fix PnP 32-bit registry handling
Change-Id: I25eae83b4783e702ca5fbe74a99d7bdeae6218f0
2017-09-06 11:54:17 -06:00
Slawomir Cygan
032ead5fa7 loader: Add new ICD search paths to loader
This change extends the functionality of searching for ICD JSONs by
adding registry locations specific to given display adapter and
software components associated with this display adapter.

The exact locations in registry are queried using Windows public PnP
Configuration Manager API[1].

This change is required, as previous ICD locations (constant path
in "HKLM/Software") may be unreachable for drivers and their
installers on Windows RS3[2].

Similar change is being made for OpenCL[2]

[1]https://msdn.microsoft.com/en-us/library/windows/hardware/ff549713.aspx
[2]https://github.com/KhronosGroup/OpenCL-ICD-Loader/pull/21
2017-08-10 09:49:24 -06:00
Lenny Komow
d801a5f5de loader: Revert ICD dlopen back to using RTLD_LAZY
Change-Id: I53ae66929ed38d81eb52cc0307341d5c8f97cdc8
2017-05-18 15:04:31 -06:00
Mark Young
d20b76a5df loader: Expand error message info
Expand loader_platform_open_library_error on Windows to include
the error message from GetLastError();

Also, modify the loading of the layer library to use the
loader_platform_open_library_error message sincce we want
to get as much error information in that as possible.

And fix a typo in a comment.

Change-Id: I1ef5ede8c6716c4624b31ddb3b32b83392920a6c
2017-05-16 11:40:14 -06:00
Mark Young
b621cae6bf loader: Expand lib search locations
Expand library search locations based on recommendations by
Dustin.  We still attempt to use the old LoadLibrary first,
and then, only if that fails, do we attempt to use the new search.

Change-Id: I4cf1358f9eb7e45ac61f36435e926aa89c212f83
2017-05-16 11:40:14 -06:00
Mark Young
e8ff6a2312 loader: Modify ICD dlopen to use RTLD_NOW
Pierre-Loup at Valve caught this.  By using RTLD_NOW on dlopen
it fails if symbols are not resolved at dlopen time.  This resolves
an error where an ICD is missing a symbol on a system causing
the loader to fail later at an unrecoverable time.

Change-Id: Icf43fd36aebfbcb4b08e7e3891570161234118f7
2017-05-16 07:54:56 -06:00