vulkan: do not distinguish instance or device LayerRef
Merge Get*LayerRef into GetLayerRef and remove LayerRef::is_instance_.
With the removal, LayerRef::SupportsExtension becomes ambiguous. Replace
it with FindLayer*Extension. Remove unused LayerRef::GetName and
LayerRef::GetSpecName while at it.
There should be no user-visible change.
Bug: 27911856
Change-Id: I38340654b52338e9ed46d1c4462a6b254b0cab64
diff --git a/vulkan/libvulkan/api.cpp b/vulkan/libvulkan/api.cpp
index 1014c14..3db625f 100644
--- a/vulkan/libvulkan/api.cpp
+++ b/vulkan/libvulkan/api.cpp
@@ -549,11 +549,7 @@
return VK_ERROR_LAYER_NOT_PRESENT;
}
- if (is_instance_)
- new (&layer) ActiveLayer{GetInstanceLayerRef(*l), {}};
- else
- new (&layer) ActiveLayer{GetDeviceLayerRef(*l), {}};
-
+ new (&layer) ActiveLayer{GetLayerRef(*l), {}};
if (!layer.ref) {
ALOGW("Failed to open layer %s", name);
layer.ref.~LayerRef();
@@ -878,10 +874,18 @@
}
bool LayerChain::IsLayerExtension(const char* name) const {
- for (uint32_t i = 0; i < layer_count_; i++) {
- const ActiveLayer& layer = layers_[i];
- if (layer.ref.SupportsExtension(name))
- return true;
+ if (is_instance_) {
+ for (uint32_t i = 0; i < layer_count_; i++) {
+ const ActiveLayer& layer = layers_[i];
+ if (FindLayerInstanceExtension(*layer.ref, name))
+ return true;
+ }
+ } else {
+ for (uint32_t i = 0; i < layer_count_; i++) {
+ const ActiveLayer& layer = layers_[i];
+ if (FindLayerDeviceExtension(*layer.ref, name))
+ return true;
+ }
}
return false;