Commit Graph

3881 Commits

Author SHA1 Message Date
Charles Giessen
451076dcbe Fix Win32 Unknown Device function handling
The handling of unknown device functions queried with vkGetInstanceProcAddr
required an additional pointer dereference to get the dispatch table.

The VkDevice handle is a pointer to the `chain_device` member of
`loader_device`. This member is actually a pointer to `loader_dispatch`, or
put another way, the "start" of `loader_device`. Thus, to get access to the
dispatch table, we need to dereference the VkDevice passed into the function
then dereference the chain_device to get loader_dispatch`.
2022-02-15 10:48:53 -07:00
Mark Young
f4a52aeeeb Fix NULL check and make a few more consistent 2022-02-15 10:47:36 -07:00
Mark Young
383cf8a6d3 Test layer pre-instance functions
Add tests to verify that the 3 pre-instance functions are properly
intercepted by the layer when everything is well-defined.

Also include two fixes:
 1) Disable environment variable value of 0 should be treated the same as not present
 2) The vkEnumerateInstanceVersion override path was broken, missing a NULL check
2022-02-15 10:47:36 -07:00
Charles Giessen
5e96fd5450 Update Windows runtime installer copyright 2022-02-14 11:07:09 -07:00
Charles Giessen
0a7407b151 Clarify behavior of override_paths + VK_LAYER_PATH
If a meta layer which contains `override_paths` is active, all of the paths in
VK_LAYER_PATH are ignored when searchign for explicit layers. This may be changed
changed in the future but for now is better tested and documented.
2022-02-11 14:16:05 -07:00
Charles Giessen
f64401a3e5 MetaLayer version checking had paren in wrong place
Produced spurious warnings for versions that are correct.
2022-02-11 11:16:10 -07:00
Charles Giessen
fcdc9ae5ac Test when there are no devices or device extensions
Adds 2 tests:
* ZeroPhysicalDevices - Return VK_ERROR_INITIALIZATION_FAILED if the driver has zero
physical devices.
* ZeroPhyiscalDeviceExtensions - Return VK_SUCCESS if no physical device extensions are
found.
2022-02-10 16:38:15 -07:00
Charles Giessen
66ee58e87a Dont return an error for 0 physical device extensions
Previously the logic of loader_add_device_extensions could return an error from
enumerating device extensions. This was because the code would return immediately
if either an error was returned from the driver or the count was zero. Now the
logic will return an error only if the driver returned an error. Zero device
extensions won't be treated as an error and will simply return VK_SUCCESS.
2022-02-10 16:38:15 -07:00
Mark Young
9ec9ef8d17 Add debug utils loader testing 2022-02-09 13:19:48 -07:00
Mark Young
b30b2aec84 Fix loader logging of VUIDs
The loader was logging some VUID failures and it was sending them to the general
message output.  Send the information also to the validation stream to make sure
that if anyone enables validation filtering they will still see those errors
2022-02-09 13:19:48 -07:00
Mark Young
3d95ca6166 Update loader VUID messages
Update the loader VUID messages that were added in validating handles
so that thye include the validation flag when going through debug utils
messenger.
2022-02-09 13:19:48 -07:00
Mark Young
15d33b4822 Add DebugReport 2022-02-09 13:19:48 -07:00
Mark Young
a332b0207c Fix Apple build
We don't want Apple builds using the Linux sorting algorithm.
2022-02-08 12:04:02 -07:00
Charles Giessen
d921cef633 Update Docs table of contents 2022-02-07 16:14:20 -07:00
Charles Giessen
610a0516d0 Remove Instance and Device extension logging
While the DEBUG level of logging is meant for verbose output, the actual extensions
enumerated rarely are useful for the purposes of debugging the loaders behavior.
With this in mind, the loader will now no longer print all the extensions found.
2022-02-07 12:23:44 -07:00
Mike Schuchardt
45d0b0df75 build: Update to header 1.3.205
- Update known-good
- Generate source
2022-02-07 10:26:31 -08:00
Charles Giessen
354fc0a1f3 Make vkGetInstanceProcAddr able to get itself
There was a regression with 1.3 that meant vkGetInstanceProcAddr wouldn't be
able to query itself if instance was set for 1.3. This commit makes it possible
to query for vkGetInstanceProcAddr with itself no matter the value of instance.
2022-02-05 19:04:36 -07:00
Brad Grantham
26283303b0 use the correct instance 2022-02-05 13:10:34 -07:00
Mark Young
ddec051dc4 Verify GIPA on device extensions
Verify that using vkGetInstanceProcAddr to get an entrypoint to a device
extension works when the extension is enabled, and crashes when the
extension isn't enabled.

Also, update a copyright notice date for my last commit.
2022-02-03 15:17:17 -07:00
Mark Young
7df1967e40 Add tests to verify extension support in physical devices
Add 2 tests to verify that physical devices supporting instance
and device extensions (which are really physical device extensions)
are properly handled.
2022-02-03 13:00:30 -07:00
Mark Young
cdebcc4ee0 Add a few tests to verify the vkGet***ProcAddr commands
Verify that the loader exported version matches the ones you
receive from vkGet****ProcAddr.
2022-02-02 16:44:55 -07:00
Charles Giessen
81f41199e5 Fix incorrect indexing of local_phys_dev_groups
Seems to have been a copy paste error that meant the group's icd_term was assigned
to the incorrect group.
2022-02-02 14:20:08 -07:00
Adam Jackson
5ccc3563ea loader: Try to handle ICD failure in vkEnumeratePhysicalDevices
If any ICD failed to enumerate device groups here, we would fail the call entirely, which means a broken driver for device A could prevent you from using device B. Just skip over the failing ICD instead.
2022-02-02 13:10:15 -07:00
Mark Young
fbea18e178 Add tests to validate layer extensions
We had tests that verified that instance and device extensions defined
in a layer had the non-null pointers returned from the corresponding
vkGetXXXProcAddr functions, but we weren't verifying that the functions
actually got called.
2022-02-01 09:39:39 -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
Charles Giessen
f4aeed4464 Fix warning for using wrong variant layers
Mistakenly used DRIVER instead of LAYER logging level.
2022-01-28 16:51:22 -07:00
Charles Giessen
393e23f91d Add wrong Variant tests 2022-01-28 16:24:27 -07:00
Charles Giessen
1c64dac9b3 Ignore layers with non zero variant value
Layers which contain an API version where the variant value is non zero are not
designed for the Vulkan-Loader, so it should be ignored.
2022-01-28 16:24:27 -07:00
Charles Giessen
9091b00fd3 Refactor json and API version parsing code
Reuse the loader_api_struct struct and associated parsing functions where
appropriate to reduce code duplication.
2022-01-28 16:24:27 -07:00
Charles Giessen
3a735a344c Skip ICD's with non zero variant value
If the JSON ICD Manifest contains an api_version that has a non zero variant
value, then the ICD should be skipped since it corresponds to a Vulkan variant.
2022-01-28 16:24:27 -07:00
Charles Giessen
ddd6b69de7 Detect Variant versions in given api versions
Since it is possible that API versions given to the loader have a variant
component, the loader should know how to handle them. It shouldn't use a
variant other than 0, but that is up to the caller to handle.
2022-01-28 16:24:27 -07:00
Charles Giessen
b411580d64 Update tests to use correct version macro
The VK_MAKE_API_VERSION macro and the VK_API_VERSION_1_X macros are better to
use. This commit switches the tests over to the non-deprecated versions of the
macros.
2022-01-28 16:24:27 -07:00
Charles Giessen
469b7c03be Warn when the apiVersion's variant isn't 0
The 1.2.175 header release saw the addition of API Variants. For the purposes
of the loader, this should always be set to 0. If this value isn't zero, the
loader should warn about it.
2022-01-28 16:24:27 -07:00
Charles Giessen
200bd55ebd Use VK_API_VERSION_XXX macros everywhere
The older VK_VERSION_XXX macros are deprecated and cause confusion when they
report a MAJOR version that is above zero. All uses of the deprecated macro are
now replaced with the correct macro.
2022-01-28 16:24:27 -07:00
Charles Giessen
8d192539c5 Add test for implicit layer with 0.1 API version
The loader disables implicit layers if their API version isn't the same or
greater than the application. Make sure this still works even with pre 1.0
versions.
2022-01-28 16:24:27 -07:00
Mark Young
8aad559a09 Test EnumPhysDev to make sure handles don't change
Add a test to make sure that the physical device handles don't change
between calls to vkEnumeratePhysicalDevices
2022-01-26 14:24:29 -07:00
Mark Young
356945ba66 Fix Linux sort order crash
We were completely re-creating the physical device lists every time
EnumeratePhysicalDevices was triggered in the loader.  This could
cause applications to have out-dated physical device handles.
We need to copy existing handles that match devices whenever they're
found.
2022-01-26 12:51:13 -07:00
Kevin McCullough
db4c3177aa Add VK_NN_vi_surface to WSI extension names array 2022-01-25 19:34:27 -07:00
Kevin McCullough
50ba247da4 VK_NN_vi_surface WSI implementation 2022-01-25 19:33:49 -07:00
Charles Giessen
997595a9ff Use size_t instead of uint32_t in test_icd
Compiler complained about possible loss of data. This fixes it.
2022-01-25 12:32:56 -07:00
Charles Giessen
41ee578e10 Update LoaderLayerInterface.md documentation
Expand override layer documentation to include override_paths

Add Versioning and Activation Interactions section which details some of the
more complex rules around when a layer is activated or not.
2022-01-25 12:32:56 -07:00
Charles Giessen
45c55b2558 Add override_paths tests for OverrideLayer
Add 4 tests:
* Shows the override_paths object in the layer manifest is being used to find a
layer.
* Shows that regular explicit layers are not found
* Shows that the log properly identifies meta layers which have an
override_paths object but shouldn't according to their manifest.
* Shows that implicit layers not in the override paths are not found.
2022-01-25 12:32:56 -07:00
Charles Giessen
cbbcc6bc64 Fix loader manifest version checks
Several version checks were underspecified and either caused false positives
or didn't catch version violations.
For example, a manifest version 1.2.0 is valid but would emit warnings implying
the version is less than 1.1.
2022-01-25 12:32:56 -07:00
Charles Giessen
c3b2624604 Add TestLayerDetails helper struct
Increasingly it is common to need more control over what the framework
environment does when adding layers. While only a refactor, this change
makes it easier to extend the functionality by adding data to the
TestLayerDetails struct.

The code to check whether the lib_path specified in add_layer_impl was
improved by using the `.stem()` functionality of the fs::path abstraction.

size_t was replaced with uint32_t where the compiler gave warnings.
2022-01-25 12:32:56 -07:00
Charles Giessen
928830f767 Make layer tests specify number of extensions
It is good practice to make use of equality checks vs comparison checks where
possible. Here, the number of extensions is knowable, as its debug_report +
debug_utils + however many come from implicit layers, which some tests do.
2022-01-25 12:32:56 -07:00
Charles Giessen
415b3e59cd Fixup tests/README to use newlines for sentences 2022-01-25 12:32:56 -07:00
Charles Giessen
a07c794826 Add meta layer blacklist test 2022-01-25 12:32:56 -07:00
Charles Giessen
f51356c3c4 Add meta layer fields to layer manifest in tests 2022-01-25 12:32:56 -07:00
Charles Giessen
2424889ef5 Add check_permutation test helper
This allows easily checking that the returned list of extensions or layers
is a valid permutation. Since the order of layers and extensions isn't
deterministic, tests cannot rely on the returned order to verify the output.
2022-01-25 12:32:56 -07:00
Charles Giessen
b9727a88d6 Add many meta-layer tests
Add tests for:
ExplicitMetaLayer - meta layer found in explicit paths
MetaLayerNameInComponentLayers - meta layer contains itself
MetaLayerWhichAddsmetaLayer - when a meta layer enables another meta layer
InstanceExtensionInComponentLayer - instance extension propagation
DeviceExtensionInComponentLayer - device extension propagation
OverrideMetaLayer.OlderVersionThanInstance - Checks behavior of override layer
  if the applications version is greater.
2022-01-25 12:32:56 -07:00