diff options
author | Charles Giessen <charles@lunarg.com> | 2022-07-08 21:17:01 +0300 |
---|---|---|
committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2022-07-08 22:32:14 +0300 |
commit | 9a45e5a4ab79b81e27e1417ca65d53ecfe57ba37 (patch) | |
tree | c3ce556de7c70a54fee80a65b85a36a32d143a6a | |
parent | 57d5dd568b701b5a3dd17d758f3a665c128116a7 (diff) |
Disable VulkanOn12/Dozen in Windows 7
Chromium still supports building for Win7, as such the newly added support for
VulkanOn12/Dozen needs to be excluded from said build. This is achieved by using
the SDK version macros defined in <sdkddkver>
-rw-r--r-- | loader/loader.c | 14 | ||||
-rw-r--r-- | loader/loader_windows.c | 22 | ||||
-rw-r--r-- | loader/loader_windows.h | 5 |
3 files changed, 21 insertions, 20 deletions
diff --git a/loader/loader.c b/loader/loader.c index f4e8f3a7b..8b73343e1 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -2910,8 +2910,10 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in bool xdg_data_dirs_secenv_alloc = true; #endif -#ifdef _WIN32 +#if defined(_WIN32) +#if WINVER >= _WIN32_WINNT_WINBLUE char *package_path = NULL; +#endif #else // Determine how much space is needed to generate the full search path // for the current manifest files. @@ -2999,7 +3001,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in } additional_env = loader_secure_getenv(VK_ADDITIONAL_DRIVER_FILES_ENV_VAR, inst); relative_location = VK_DRIVERS_INFO_RELATIVE_DIR; -#ifdef _WIN32 +#if defined(_WIN32) && WINVER >= _WIN32_WINNT_WINBLUE package_path = windows_get_app_package_manifest_path(inst); #endif break; @@ -3033,8 +3035,8 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in // Add the size of any additional search paths defined in the additive environment variable if (NULL != additional_env) { search_path_size += determine_data_file_path_size(additional_env, 0) + 2; -#ifdef _WIN32 - } +#if defined(_WIN32) && WINVER >= _WIN32_WINNT_WINBLUE + } if (NULL != package_path) { search_path_size += determine_data_file_path_size(package_path, 0) + 2; } @@ -3090,7 +3092,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in copy_data_file_info(additional_env, NULL, 0, &cur_path_ptr); } -#ifdef _WIN32 +#if defined(_WIN32) && WINVER >= _WIN32_WINNT_WINBLUE if (NULL != package_path) { copy_data_file_info(package_path, NULL, 0, &cur_path_ptr); } @@ -3229,7 +3231,7 @@ out: if (NULL != override_env) { loader_free_getenv(override_env, inst); } -#ifdef _WIN32 +#if defined(_WIN32) && WINVER >= _WIN32_WINNT_WINBLUE if (NULL != package_path) { loader_instance_heap_free(inst, package_path); } diff --git a/loader/loader_windows.c b/loader/loader_windows.c index 1ad74e96c..f99d05df9 100644 --- a/loader/loader_windows.c +++ b/loader/loader_windows.c @@ -51,7 +51,9 @@ #include <dxgi1_6.h> #include "adapters.h" +#if WINVER >= _WIN32_WINNT_WINBLUE #include <appmodel.h> +#endif #if !defined(NDEBUG) #include <crtdbg.h> @@ -998,17 +1000,15 @@ VkResult windows_sort_physical_device_groups(struct loader_instance *inst, const return VK_SUCCESS; } -char *windows_get_app_package_manifest_path(const struct loader_instance *inst) -{ +#if WINVER >= _WIN32_WINNT_WINBLUE +char *windows_get_app_package_manifest_path(const struct loader_instance *inst) { UINT32 numPackages = 0, bufferLength = 0; /* This literal string identifies the Microsoft-published OpenCL and OpenGL Compatibility Pack * (so named at the time this is being added), which contains OpenGLOn12 and OpenCLOn12 mapping * layers, and will contain VulkanOn12 (aka Dozen) going forward. */ PCWSTR familyName = L"Microsoft.D3DMappingLayers_8wekyb3d8bbwe"; - if (ERROR_INSUFFICIENT_BUFFER != GetPackagesByPackageFamily(familyName, - &numPackages, NULL, - &bufferLength, NULL) || + if (ERROR_INSUFFICIENT_BUFFER != GetPackagesByPackageFamily(familyName, &numPackages, NULL, &bufferLength, NULL) || numPackages == 0 || bufferLength == 0) { loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, "windows_get_app_package_manifest_path: Failed to find mapping layers packages by family name\n"); @@ -1024,9 +1024,7 @@ char *windows_get_app_package_manifest_path(const struct loader_instance *inst) goto cleanup; } - if (ERROR_SUCCESS != GetPackagesByPackageFamily(familyName, - &numPackages, packages, - &bufferLength, buffer)) { + if (ERROR_SUCCESS != GetPackagesByPackageFamily(familyName, &numPackages, packages, &bufferLength, buffer)) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "windows_get_app_package_manifest_path: Failed to mapping layers package full names\n"); goto cleanup; @@ -1035,8 +1033,7 @@ char *windows_get_app_package_manifest_path(const struct loader_instance *inst) UINT32 pathLength = 0; WCHAR path[MAX_PATH]; memset(path, 0, sizeof(path)); - if (ERROR_INSUFFICIENT_BUFFER != GetPackagePathByFullName(packages[0], &pathLength, NULL) || - pathLength > MAX_PATH || + if (ERROR_INSUFFICIENT_BUFFER != GetPackagePathByFullName(packages[0], &pathLength, NULL) || pathLength > MAX_PATH || ERROR_SUCCESS != GetPackagePathByFullName(packages[0], &pathLength, path)) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "windows_get_app_package_manifest_path: Failed to get mapping layers package path\n"); @@ -1052,8 +1049,7 @@ char *windows_get_app_package_manifest_path(const struct loader_instance *inst) ret = loader_instance_heap_alloc(inst, narrowPathLength, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); if (!ret) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "windows_get_app_package_manifest_path: Failed to allocate path\n"); + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "windows_get_app_package_manifest_path: Failed to allocate path\n"); goto cleanup; } @@ -1065,5 +1061,5 @@ cleanup: loader_instance_heap_free(inst, packages); return ret; } - +#endif #endif // _WIN32 diff --git a/loader/loader_windows.h b/loader/loader_windows.h index 2e34f6574..f1c6fbb1e 100644 --- a/loader/loader_windows.h +++ b/loader/loader_windows.h @@ -35,6 +35,7 @@ #include <minwindef.h> #include <cfgmgr32.h> +#include <sdkddkver.h> // Windows specific initialization functionality void windows_initialization(void); @@ -112,7 +113,9 @@ VkResult windows_sort_physical_device_groups(struct loader_instance *inst, const // Returns VkLoaderFeatureFlags containing VK_LOADER_FEATURE_PHYSICAL_DEVICE_SORTING if successful, otherwise 0 VkLoaderFeatureFlags windows_initialize_dxgi(void); +#if WINVER >= _WIN32_WINNT_WINBLUE // Only Available on windows 8 and above // Retrieve a path to an installed app package that contains Vulkan manifests. // When done using the returned string, the caller should free the pointer. char *windows_get_app_package_manifest_path(const struct loader_instance *inst); -#endif // WIN32
\ No newline at end of file +#endif +#endif // WIN32 |