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.
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.
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.
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.
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.
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.
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)
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.
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.
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
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.
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.
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.
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
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
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.
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
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
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
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.
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
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
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
Fix the loader's global initialization being skipped when the loader
is built as a static library on windows
Change-Id: I492f87104fb3bf32aed3c7d251dee2caeb4f00ba
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
Fixes:
format specifies type 'int' but the argument has type 'DWORD' (aka 'unsigned long') [-Werror,-Wformat]
error : expected ')' (issue with __FUNCTION__ and format string)
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
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
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
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