summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/wrapper.cpp83
-rw-r--r--src/video_core/renderer_vulkan/wrapper.h40
2 files changed, 123 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/wrapper.cpp b/src/video_core/renderer_vulkan/wrapper.cpp
index 0795fbcc6..242cfff6e 100644
--- a/src/video_core/renderer_vulkan/wrapper.cpp
+++ b/src/video_core/renderer_vulkan/wrapper.cpp
@@ -650,4 +650,87 @@ void Device::UpdateDescriptorSets(Span<VkWriteDescriptorSet> writes,
dld->vkUpdateDescriptorSets(handle, writes.size(), writes.data(), copies.size(), copies.data());
}
+VkPhysicalDeviceProperties PhysicalDevice::GetProperties() const noexcept {
+ VkPhysicalDeviceProperties properties;
+ dld->vkGetPhysicalDeviceProperties(physical_device, &properties);
+ return properties;
+}
+
+void PhysicalDevice::GetProperties2KHR(VkPhysicalDeviceProperties2KHR& properties) const noexcept {
+ dld->vkGetPhysicalDeviceProperties2KHR(physical_device, &properties);
+}
+
+VkPhysicalDeviceFeatures PhysicalDevice::GetFeatures() const noexcept {
+ VkPhysicalDeviceFeatures2KHR features2;
+ features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR;
+ features2.pNext = nullptr;
+ dld->vkGetPhysicalDeviceFeatures2KHR(physical_device, &features2);
+ return features2.features;
+}
+
+void PhysicalDevice::GetFeatures2KHR(VkPhysicalDeviceFeatures2KHR& features) const noexcept {
+ dld->vkGetPhysicalDeviceFeatures2KHR(physical_device, &features);
+}
+
+VkFormatProperties PhysicalDevice::GetFormatProperties(VkFormat format) const noexcept {
+ VkFormatProperties properties;
+ dld->vkGetPhysicalDeviceFormatProperties(physical_device, format, &properties);
+ return properties;
+}
+
+std::vector<VkExtensionProperties> PhysicalDevice::EnumerateDeviceExtensionProperties() const {
+ u32 num;
+ dld->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &num, nullptr);
+ std::vector<VkExtensionProperties> properties(num);
+ dld->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &num, properties.data());
+ return properties;
+}
+
+std::vector<VkQueueFamilyProperties> PhysicalDevice::GetQueueFamilyProperties() const {
+ u32 num;
+ dld->vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &num, nullptr);
+ std::vector<VkQueueFamilyProperties> properties(num);
+ dld->vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &num, properties.data());
+ return properties;
+}
+
+bool PhysicalDevice::GetSurfaceSupportKHR(u32 queue_family_index, VkSurfaceKHR surface) const {
+ VkBool32 supported;
+ Check(dld->vkGetPhysicalDeviceSurfaceSupportKHR(physical_device, queue_family_index, surface,
+ &supported));
+ return supported == VK_TRUE;
+}
+
+VkSurfaceCapabilitiesKHR PhysicalDevice::GetSurfaceCapabilitiesKHR(VkSurfaceKHR surface) const
+ noexcept {
+ VkSurfaceCapabilitiesKHR capabilities;
+ Check(dld->vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device, surface, &capabilities));
+ return capabilities;
+}
+
+std::vector<VkSurfaceFormatKHR> PhysicalDevice::GetSurfaceFormatsKHR(VkSurfaceKHR surface) const {
+ u32 num;
+ Check(dld->vkGetPhysicalDeviceSurfaceFormatsKHR(physical_device, surface, &num, nullptr));
+ std::vector<VkSurfaceFormatKHR> formats(num);
+ Check(
+ dld->vkGetPhysicalDeviceSurfaceFormatsKHR(physical_device, surface, &num, formats.data()));
+ return formats;
+}
+
+std::vector<VkPresentModeKHR> PhysicalDevice::GetSurfacePresentModesKHR(
+ VkSurfaceKHR surface) const {
+ u32 num;
+ Check(dld->vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device, surface, &num, nullptr));
+ std::vector<VkPresentModeKHR> modes(num);
+ Check(dld->vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device, surface, &num,
+ modes.data()));
+ return modes;
+}
+
+VkPhysicalDeviceMemoryProperties PhysicalDevice::GetMemoryProperties() const noexcept {
+ VkPhysicalDeviceMemoryProperties properties;
+ dld->vkGetPhysicalDeviceMemoryProperties(physical_device, &properties);
+ return properties;
+}
+
} // namespace Vulkan::vk
diff --git a/src/video_core/renderer_vulkan/wrapper.h b/src/video_core/renderer_vulkan/wrapper.h
index 6ac5a8f59..5d6a0227a 100644
--- a/src/video_core/renderer_vulkan/wrapper.h
+++ b/src/video_core/renderer_vulkan/wrapper.h
@@ -749,4 +749,44 @@ public:
}
};
+class PhysicalDevice {
+public:
+ constexpr PhysicalDevice() noexcept = default;
+
+ constexpr PhysicalDevice(VkPhysicalDevice physical_device, const InstanceDispatch& dld) noexcept
+ : physical_device{physical_device}, dld{&dld} {}
+
+ constexpr operator VkPhysicalDevice() const noexcept {
+ return physical_device;
+ }
+
+ VkPhysicalDeviceProperties GetProperties() const noexcept;
+
+ void GetProperties2KHR(VkPhysicalDeviceProperties2KHR&) const noexcept;
+
+ VkPhysicalDeviceFeatures GetFeatures() const noexcept;
+
+ void GetFeatures2KHR(VkPhysicalDeviceFeatures2KHR&) const noexcept;
+
+ VkFormatProperties GetFormatProperties(VkFormat) const noexcept;
+
+ std::vector<VkExtensionProperties> EnumerateDeviceExtensionProperties() const;
+
+ std::vector<VkQueueFamilyProperties> GetQueueFamilyProperties() const;
+
+ bool GetSurfaceSupportKHR(u32 queue_family_index, VkSurfaceKHR) const;
+
+ VkSurfaceCapabilitiesKHR GetSurfaceCapabilitiesKHR(VkSurfaceKHR) const noexcept;
+
+ std::vector<VkSurfaceFormatKHR> GetSurfaceFormatsKHR(VkSurfaceKHR) const;
+
+ std::vector<VkPresentModeKHR> GetSurfacePresentModesKHR(VkSurfaceKHR) const;
+
+ VkPhysicalDeviceMemoryProperties GetMemoryProperties() const noexcept;
+
+private:
+ VkPhysicalDevice physical_device = nullptr;
+ const InstanceDispatch* dld = nullptr;
+};
+
} // namespace Vulkan::vk