Hash :
3226a3df
Author :
Date :
2024-12-13T14:06:55
Reland: vulkan: add EGL_ANGLE_platform_angle_vulkan_device_uuid
Implement the ability to select a specific device and driver combination
through a few new selection criteria:
VkPhysicalDeviceIDProperties::deviceUUID
VkPhysicalDeviceIDProperties::driverUUID
VkPhysicalDeviceDriverProperties::driverID
Earlier version had problems due to a test build issue. Per syoussefi@,
going to rework the test into a separate CL so that we get the core
change merged.
Bug: angleproject:351866412
Change-Id: I0a3f4f1a2154a06bf6286a037c9ad4834ef4dda2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6165286
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Auto-Submit: Steven Noonan <steven@uplinklabs.net>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
//
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// vulkan_icd.h : Helper for creating vulkan instances & selecting physical device.
#ifndef COMMON_VULKAN_VULKAN_ICD_H_
#define COMMON_VULKAN_VULKAN_ICD_H_
#include <string>
#include "common/Optional.h"
#include "common/angleutils.h"
#include "common/vulkan/vk_headers.h"
namespace angle
{
namespace vk
{
// The minimum version of Vulkan that ANGLE requires. If an instance or device below this version
// is encountered, initialization will skip the device if possible, or if no other suitable device
// is available then initialization will fail.
constexpr uint32_t kMinimumVulkanAPIVersion = VK_API_VERSION_1_1;
enum class ICD
{
Default,
Mock,
SwiftShader,
};
struct SimpleDisplayWindow
{
uint16_t width;
uint16_t height;
};
class [[nodiscard]] ScopedVkLoaderEnvironment : angle::NonCopyable
{
public:
ScopedVkLoaderEnvironment(bool enableDebugLayers, vk::ICD icd);
~ScopedVkLoaderEnvironment();
bool canEnableDebugLayers() const { return mEnableDebugLayers; }
vk::ICD getEnabledICD() const { return mICD; }
private:
bool setICDEnvironment(const char *icd);
bool mEnableDebugLayers;
vk::ICD mICD;
bool mChangedCWD;
Optional<std::string> mPreviousCWD;
bool mChangedICDEnv;
Optional<std::string> mPreviousICDEnv;
Optional<std::string> mPreviousCustomExtensionsEnv;
bool mChangedNoDeviceSelect;
Optional<std::string> mPreviousNoDeviceSelectEnv;
};
void ChoosePhysicalDevice(PFN_vkGetPhysicalDeviceProperties2 pGetPhysicalDeviceProperties2,
const std::vector<VkPhysicalDevice> &physicalDevices,
vk::ICD preferredICD,
uint32_t preferredVendorID,
uint32_t preferredDeviceID,
const uint8_t *preferredDeviceUUID,
const uint8_t *preferredDriverUUID,
VkDriverId preferredDriverID,
VkPhysicalDevice *physicalDeviceOut,
VkPhysicalDeviceProperties2 *physicalDeviceProperties2Out,
VkPhysicalDeviceIDProperties *physicalDeviceIDPropertiesOut,
VkPhysicalDeviceDriverProperties *physicalDeviceDriverPropertiesOut);
} // namespace vk
} // namespace angle
#endif // COMMON_VULKAN_VULKAN_ICD_H_