vulkan_info.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef GPU_CONFIG_VULKAN_INFO_H_
  5. #define GPU_CONFIG_VULKAN_INFO_H_
  6. #include <vulkan/vulkan_core.h>
  7. #include <vector>
  8. #include "base/strings/string_piece.h"
  9. #include "gpu/gpu_export.h"
  10. #include "ui/gfx/extension_set.h"
  11. namespace gpu {
  12. class GPU_EXPORT VulkanPhysicalDeviceInfo {
  13. public:
  14. VulkanPhysicalDeviceInfo();
  15. VulkanPhysicalDeviceInfo(const VulkanPhysicalDeviceInfo& other);
  16. ~VulkanPhysicalDeviceInfo();
  17. VulkanPhysicalDeviceInfo& operator=(const VulkanPhysicalDeviceInfo& other);
  18. // This is a local variable in GPU process, it will not be sent via IPC.
  19. VkPhysicalDevice device = VK_NULL_HANDLE;
  20. VkPhysicalDeviceProperties properties = {};
  21. VkPhysicalDeviceDriverProperties driver_properties = {};
  22. std::vector<VkExtensionProperties> extensions;
  23. VkPhysicalDeviceFeatures features = {};
  24. // Extended physical device features:
  25. bool feature_sampler_ycbcr_conversion = false;
  26. bool feature_protected_memory = false;
  27. std::vector<VkQueueFamilyProperties> queue_families;
  28. };
  29. class GPU_EXPORT VulkanInfo {
  30. public:
  31. VulkanInfo();
  32. VulkanInfo(const VulkanInfo& other);
  33. ~VulkanInfo();
  34. VulkanInfo& operator=(const VulkanInfo& other);
  35. std::vector<uint8_t> Serialize() const;
  36. void SetEnabledInstanceExtensions(const std::vector<const char*>& extensions);
  37. void SetEnabledInstanceExtensions(
  38. const std::vector<base::StringPiece>& extensions);
  39. uint32_t api_version = VK_MAKE_VERSION(1, 0, 0);
  40. uint32_t used_api_version = VK_MAKE_VERSION(1, 0, 0);
  41. std::vector<VkExtensionProperties> instance_extensions;
  42. std::vector<const char*> enabled_instance_extensions;
  43. std::vector<VkLayerProperties> instance_layers;
  44. std::vector<VulkanPhysicalDeviceInfo> physical_devices;
  45. };
  46. } // namespace gpu
  47. #endif // GPU_CONFIG_VULKAN_INFO_H_