OSDN Git Service

Inline GetPhysicalDeviceProperties2 into QueryPresentationProperties s-x86
authorChris Forbes <chrisforbes@google.com>
Thu, 22 Jul 2021 20:54:04 +0000 (13:54 -0700)
committerMauro Rossi <issor.oruam@gmail.com>
Mon, 24 Jul 2023 16:03:31 +0000 (18:03 +0200)
commite9ad16b6aadd0107da2162e37dea9d9fdf742ba0
tree9679e1c07e91ca79b89077da7fcee44c03fc7327
parent371900081e2c9d730390efbdc2bd70c4d8813f2f
Inline GetPhysicalDeviceProperties2 into QueryPresentationProperties

In general, we implement the 1.1 instance / physical device API as
preferring to call the native 1.1 function if available; otherwise
falling back to calling the equivalent GPDP2 function. If the
underlying driver supports *neither* then any caller of that function
has already invoked UB by calling it and so falling over is acceptable.

Unfortunately, the loader itself does call vkGetPhysicalDeviceProperties2
in one case, regardless of what the driver may support, in order to
determine whether the platform's swapchain implementation should expose
some features. On a 1.0 driver without the GPDP2 extension, this caused
trouble.

As a slight further wrinkle, vkGetPhysicalDeviceProperties2 "cannot
fail", making propagating a failure back up through the loader annoying.

As a workaround, inline the calls to GetPhysicalDeviceProperties2 and
GetPhysicalDeviceProperties2KHR into QueryPresentationProperties, where
we can handle our one special case of both function pointers being
missing but behavior being defined.

Bug: b/192130684
Change-Id: Iff2bae98b7931bed80fafd895cf57061becabd8d
(cherry picked from commit e056c12782125c3ad5876f3ac7528d9889808675)
vulkan/libvulkan/driver.cpp