Skip to content

Commit

Permalink
Clarify the VK_LOADER_DRIVERS_SELECT example
Browse files Browse the repository at this point in the history
In the documentation examples, if we set
`VK_LOADER_DRIVERS_SELECT=nvidia`, we are saying to the loader to select
only the driver whose JSON manifest is called exactly `nvidia`.

This is likely not what we want, because the Nvidia drivers are usually
called something like `nvidia_icd.json`, and not just `nvidia` without a
file extension.

In the "Behavior" column it already states that:
"Since drivers don’t have a name like layers, this glob is used to
compare against the manifest filename."
So, to avoid confusion, we just need to change the example to reflect
how the loader glob works.

This commit also adds an additional automated test to ensure that this
full-name string glob actually works as described in the documentation.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
  • Loading branch information
RyuzakiKK authored and charles-lunarg committed Jan 31, 2023
1 parent dda7872 commit e90b9e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/LoaderInterfaceArchitecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,10 @@ discovery.
</small></td>
<td><small>
export<br/>
&nbsp;&nbsp;VK_LOADER_DRIVERS_SELECT=nvidia<br/>
&nbsp;&nbsp;VK_LOADER_DRIVERS_SELECT=nvidia*<br/>
<br/>
set<br/>
&nbsp;&nbsp;VK_LOADER_DRIVERS_SELECT=nvidia<br/><br/>
&nbsp;&nbsp;VK_LOADER_DRIVERS_SELECT=nvidia*<br/><br/>
The above would select only the Nvidia driver if it was present on the
system and already visible to the loader.
</small></td>
Expand Down
18 changes: 18 additions & 0 deletions tests/loader_envvar_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,24 @@ TEST(EnvVarICDOverrideSetup, FilterSelectDriver) {
ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));

// The full-name string is not a valid match if it doesn't also include the file extension
env.debug_log.clear();
filter_select_env_var.set_new_value("ABC_ICD");

InstWrapper inst8{env.vulkan_functions};
FillDebugUtilsCreateDetails(inst8.create_info, env.debug_log);
inst8.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER);

ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json"));
ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var"));
ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var"));
ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json"));
ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var"));
ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var"));
ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json"));
ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var"));
ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var"));
}

// Test that the driver filter disable disables driver manifest files that match the filter
Expand Down

0 comments on commit e90b9e0

Please sign in to comment.