vulkan: refactor layer extension enumeration
Replace Get*LayerExtensions by a set of new functions that do not
distinguish instance and device layers.
There should be no user-visible change.
Bug: 27911856
Change-Id: Icd98abf51a936769f8f2f218794043b5e2611c5c
diff --git a/vulkan/libvulkan/api.cpp b/vulkan/libvulkan/api.cpp
index e3f69fe..6d558ee 100644
--- a/vulkan/libvulkan/api.cpp
+++ b/vulkan/libvulkan/api.cpp
@@ -1123,7 +1123,14 @@
if (pLayerName) {
const VkExtensionProperties* props;
uint32_t count;
- GetInstanceLayerExtensions(pLayerName, &props, &count);
+
+ const Layer* layer = FindLayer(pLayerName);
+ if (layer) {
+ props = GetLayerInstanceExtensions(*layer, count);
+ } else {
+ props = nullptr;
+ count = 0;
+ }
if (!pProperties || *pPropertyCount > count)
*pPropertyCount = count;
@@ -1181,7 +1188,14 @@
if (pLayerName) {
const VkExtensionProperties* props;
uint32_t count;
- GetDeviceLayerExtensions(pLayerName, &props, &count);
+
+ const Layer* layer = FindLayer(pLayerName);
+ if (layer && IsLayerGlobal(*layer)) {
+ props = GetLayerDeviceExtensions(*layer, count);
+ } else {
+ props = nullptr;
+ count = 0;
+ }
if (!pProperties || *pPropertyCount > count)
*pPropertyCount = count;