Skip to content

Commit

Permalink
Update docs to reflect Vulkan->VulkanSC regkey change
Browse files Browse the repository at this point in the history
Also, duplicate the regkey definitions between tests/ and loader/, per
PR feedback on #22.
  • Loading branch information
zangold authored and aqnuep committed Dec 19, 2023
1 parent 9c84e14 commit 3d16cf2
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 31 deletions.
14 changes: 14 additions & 0 deletions docs/LoaderDriverInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@ HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Adapter GUID}\000X\Vu
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{SoftwareComponent GUID}\000X\VulkanDriverName
```

Or, for VulkanSC:

```
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Adapter GUID}\000X\VulkanSCDriverName
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{SoftwareComponent GUID}\000X\VulkanSCDriverName
```

In addition, on 64-bit systems there may be another set of registry values,
listed below.
These values record the locations of 32-bit layers on 64-bit operating systems,
Expand All @@ -314,6 +321,13 @@ HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Adapter GUID}\000X\Vu
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{SoftwareComponent GUID}\000X\VulkanDriverNameWow
```

And for VulkanSC:

```
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Adapter GUID}\000X\VulkanDriverNameWow
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{SoftwareComponent GUID}\000X\VulkanDriverNameWow
```

If any of the above values exist and is of type `REG_SZ`, the loader will open
the JSON manifest file specified by the key value.
Each value must be a full absolute path to a JSON manifest file.
Expand Down
38 changes: 37 additions & 1 deletion docs/LoaderLayerInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\ImplicitLayers
HKEY_CURRENT_USER\SOFTWARE\Khronos\Vulkan\ImplicitLayers
```

Or, for VulkanSC:

```
HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\VulkanSC\ExplicitLayers
HKEY_CURRENT_USER\SOFTWARE\Khronos\VulkanSC\ExplicitLayers
HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\VulkanSC\ImplicitLayers
HKEY_CURRENT_USER\SOFTWARE\Khronos\VulkanSC\ImplicitLayers
```

Except when running a 32-bit application on 64-bit Windows, when the loader
will instead scan the 32-bit registry location:

Expand All @@ -181,6 +190,15 @@ HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Khronos\Vulkan\ImplicitLayers
HKEY_CURRENT_USER\SOFTWARE\WOW6432Node\Khronos\Vulkan\ImplicitLayers
```

For VulkanSC:

```
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Khronos\VulkanSC\ExplicitLayers
HKEY_CURRENT_USER\SOFTWARE\WOW6432Node\Khronos\VulkanSC\ExplicitLayers
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Khronos\VulkanSC\ImplicitLayers
HKEY_CURRENT_USER\SOFTWARE\WOW6432Node\Khronos\VulkanSC\ImplicitLayers
```

For each value in these keys which has DWORD data set to 0, the loader opens
the JSON manifest file specified by the name of the value.
Each name must be an absolute path to the manifest file.
Expand Down Expand Up @@ -208,6 +226,15 @@ HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Software Component GU
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Software Component GUID}\000X\VulkanImplicitLayers
```

And, for VulkanSC:

```
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Adapter GUID}\000X\VulkanSCExplicitLayers
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Adapter GUID}\000X\VulkanSCImplicitLayers
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Software Component GUID}\000X\VulkanSCExplicitLayers
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Software Component GUID}\000X\VulkanSCImplicitLayers
```

In addition, on 64-bit systems there may be another set of registry values,
listed below.
These values record the locations of 32-bit layers on 64-bit operating systems,
Expand All @@ -220,14 +247,23 @@ HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Software Component GU
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Software Component GUID}\000X\VulkanImplicitLayersWow
```

For VulkanSC:

```
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Adapter GUID}\000X\VulkanSCExplicitLayersWow
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Adapter GUID}\000X\VulkanSCImplicitLayersWow
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Software Component GUID}\000X\VulkanSCExplicitLayersWow
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Software Component GUID}\000X\VulkanSCImplicitLayersWow
```

If any of the above values exist and is of type `REG_SZ`, the loader will open
the JSON manifest file specified by the key value.
Each value must be an absolute path to a JSON manifest file.
A key value may also be of type `REG_MULTI_SZ`, in which case the value will be
interpreted as a list of paths to JSON manifest files.

In general, applications should install layers into the
`SOFTWARE\Khronos\Vulkan` paths.
`SOFTWARE\Khronos\Vulkan` and `SOFTWARE\Khronos\VulkanSC` paths.
The PnP registry locations are intended specifically for layers that are
distributed as part of a driver installation.
An application installer should not modify the device-specific registries,
Expand Down
40 changes: 18 additions & 22 deletions loader/vk_loader_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@
#define COMMON_UNIX_PLATFORMS 0
#endif

#ifdef VULKANSC
#define API_VARIANT "SC"
#define API_VARIANT_W L"SC"
#else
#define API_VARIANT ""
#define API_VARIANT_W L""
#endif

#if COMMON_UNIX_PLATFORMS
#include <unistd.h>
// Note: The following file is for dynamic loading:
Expand Down Expand Up @@ -199,10 +191,18 @@ typedef pthread_cond_t loader_platform_thread_cond;
#define VK_ELAYERS_INFO_RELATIVE_DIR ""
#define VK_ILAYERS_INFO_RELATIVE_DIR ""

#define VK_DRIVERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" API_VARIANT "\\Drivers"
#define VK_ELAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" API_VARIANT "\\ExplicitLayers"
#define VK_ILAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" API_VARIANT "\\ImplicitLayers"
#define VK_SETTINGS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" API_VARIANT "\\LoaderSettings"
#ifdef VULKANSC
#define VK_VARIANT_REG_STR "SC"
#define VK_VARIANT_REG_STR_W L"SC"
#else
#define VK_VARIANT_REG_STR ""
#define VK_VARIANT_REG_STR_W L""
#endif

#define VK_DRIVERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\Drivers"
#define VK_ELAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ExplicitLayers"
#define VK_ILAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ImplicitLayers"
#define VK_SETTINGS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\LoaderSettings"

#define PRINTF_SIZE_T_SPECIFIER "%Iu"

Expand Down Expand Up @@ -257,8 +257,6 @@ static inline void loader_platform_thread_once_fn(pthread_once_t *ctl, void (*fu

#endif

#if !defined(LOADER_PLATFORM_SKIP_FUNCTION_DEFINITIONS)

#if COMMON_UNIX_PLATFORMS

// File IO
Expand Down Expand Up @@ -443,38 +441,38 @@ static inline char *loader_strncpy(char *dest, size_t dest_sz, const char *src,
static inline const char *LoaderPnpDriverRegistry() {
BOOL is_wow;
IsWow64Process(GetCurrentProcess(), &is_wow);
return is_wow ? "Vulkan" API_VARIANT "DriverNameWow" : "Vulkan" API_VARIANT "DriverName";
return is_wow ? "Vulkan" VK_VARIANT_REG_STR "DriverNameWow" : "Vulkan" VK_VARIANT_REG_STR "DriverName";
}
static inline const wchar_t *LoaderPnpDriverRegistryWide() {
BOOL is_wow;
IsWow64Process(GetCurrentProcess(), &is_wow);
return is_wow ? L"Vulkan" API_VARIANT_W L"DriverNameWow" : L"Vulkan" API_VARIANT_W L"DriverName";
return is_wow ? L"Vulkan" VK_VARIANT_REG_STR_W L"DriverNameWow" : L"Vulkan" VK_VARIANT_REG_STR_W L"DriverName";
}

// Get the key for the plug 'n play explicit layer registry
// The string returned by this function should NOT be freed
static inline const char *LoaderPnpELayerRegistry() {
BOOL is_wow;
IsWow64Process(GetCurrentProcess(), &is_wow);
return is_wow ? "Vulkan" API_VARIANT "ExplicitLayersWow" : "Vulkan" API_VARIANT "ExplicitLayers";
return is_wow ? "Vulkan" VK_VARIANT_REG_STR "ExplicitLayersWow" : "Vulkan" VK_VARIANT_REG_STR "ExplicitLayers";
}
static inline const wchar_t *LoaderPnpELayerRegistryWide() {
BOOL is_wow;
IsWow64Process(GetCurrentProcess(), &is_wow);
return is_wow ? L"Vulkan" API_VARIANT_W L"ExplicitLayersWow" : L"Vulkan" API_VARIANT_W L"ExplicitLayers";
return is_wow ? L"Vulkan" VK_VARIANT_REG_STR_W L"ExplicitLayersWow" : L"Vulkan" VK_VARIANT_REG_STR_W L"ExplicitLayers";
}

// Get the key for the plug 'n play implicit layer registry
// The string returned by this function should NOT be freed
static inline const char *LoaderPnpILayerRegistry() {
BOOL is_wow;
IsWow64Process(GetCurrentProcess(), &is_wow);
return is_wow ? "Vulkan" API_VARIANT "ImplicitLayersWow" : "Vulkan" API_VARIANT "ImplicitLayers";
return is_wow ? "Vulkan" VK_VARIANT_REG_STR "ImplicitLayersWow" : "Vulkan" VK_VARIANT_REG_STR "ImplicitLayers";
}
static inline const wchar_t *LoaderPnpILayerRegistryWide() {
BOOL is_wow;
IsWow64Process(GetCurrentProcess(), &is_wow);
return is_wow ? L"Vulkan" API_VARIANT_W L"ImplicitLayersWow" : L"Vulkan" API_VARIANT_W L"ImplicitLayers";
return is_wow ? L"Vulkan" VK_VARIANT_REG_STR_W L"ImplicitLayersWow" : L"Vulkan" VK_VARIANT_REG_STR_W L"ImplicitLayers";
}

// File IO
Expand Down Expand Up @@ -625,5 +623,3 @@ static inline char *loader_strncpy(char *dest, size_t dest_sz, const char *src,
// files with "WIN32" in it, as a quick way to find files that must be changed.

#endif // defined(_WIN32)

#endif // !defined(LOADER_PLATFORM_SKIP_FUNCTION_DEFS)
13 changes: 13 additions & 0 deletions tests/framework/shim/shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ enum class ManifestCategory { implicit_layer, explicit_layer, icd, settings };
enum class GpuType { unspecified, integrated, discrete, external };

#if defined(WIN32)
#ifdef VULKANSC
#define VK_VARIANT_REG_STR "SC"
#define VK_VARIANT_REG_STR_W L"SC"
#else
#define VK_VARIANT_REG_STR ""
#define VK_VARIANT_REG_STR_W L""
#endif

#define VK_DRIVERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\Drivers"
#define VK_ELAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ExplicitLayers"
#define VK_ILAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ImplicitLayers"
#define VK_SETTINGS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\LoaderSettings"

struct RegistryEntry {
RegistryEntry() = default;
RegistryEntry(std::string const& name) noexcept : name(name) {}
Expand Down
4 changes: 0 additions & 4 deletions tests/framework/shim/windows_shim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@

#include "detours.h"

#define LOADER_PLATFORM_SKIP_FUNCTION_DEFINITIONS
#include "loader/vk_loader_platform.h"
#undef LOADER_PLATFORM_SKIP_FUNCTION_DEFINITIONS

static PlatformShim platform_shim;

extern "C" {
Expand Down
4 changes: 0 additions & 4 deletions tests/loader_regression_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@

#include "test_environment.h"

#define LOADER_PLATFORM_SKIP_FUNCTION_DEFINITIONS
#include "loader/vk_loader_platform.h"
#undef LOADER_PLATFORM_SKIP_FUNCTION_DEFINITIONS

// Test case origin
// LX = lunar exchange
// LVLGH = loader and validation github
Expand Down

0 comments on commit 3d16cf2

Please sign in to comment.