summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-12-02 14:19:53 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-12-02 14:19:53 +0000
commit43603d6024243e95da8f7193a1597165053cc613 (patch)
treef6385e43c48b18a8ddeb09d07eb0a6b868ad6c4f
parentc2097c91a5a94393b5215963bff82395ef81798c (diff)
parentda5e142f01d757d503b93ea814853d62928444f4 (diff)
downloadnative-43603d6024243e95da8f7193a1597165053cc613.tar.gz
Merge "Inline GetPhysicalDeviceProperties2 into QueryPresentationProperties" into android12-gsi
-rw-r--r--vulkan/libvulkan/driver.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index d7fdab5586..cf774fd9b8 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -979,6 +979,8 @@ VkResult EnumerateInstanceExtensionProperties(
void QueryPresentationProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDevicePresentationPropertiesANDROID* presentation_properties) {
+ ATRACE_CALL();
+
// Request the android-specific presentation properties via GPDP2
VkPhysicalDeviceProperties2 properties = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
@@ -994,7 +996,17 @@ void QueryPresentationProperties(
presentation_properties->pNext = nullptr;
presentation_properties->sharedImage = VK_FALSE;
- GetPhysicalDeviceProperties2(physicalDevice, &properties);
+ const auto& driver = GetData(physicalDevice).driver;
+
+ if (driver.GetPhysicalDeviceProperties2) {
+ // >= 1.1 driver, supports core GPDP2 entrypoint.
+ driver.GetPhysicalDeviceProperties2(physicalDevice, &properties);
+ } else if (driver.GetPhysicalDeviceProperties2KHR) {
+ // Old driver, but may support presentation properties
+ // if we have the GPDP2 extension. Otherwise, no presentation
+ // properties supported.
+ driver.GetPhysicalDeviceProperties2KHR(physicalDevice, &properties);
+ }
}
VkResult EnumerateDeviceExtensionProperties(