Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 7e6dab6

Browse files
authored
[Impeller] Added helper messaging around validation usage (#42708)
Adds some helper messages around using validation layers. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent 91f57e5 commit 7e6dab6

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

impeller/renderer/backend/vulkan/BUILD.gn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5+
import("//flutter/vulkan/config.gni")
56
import("../../../tools/impeller.gni")
67

78
impeller_component("vulkan_unittests") {
@@ -96,4 +97,8 @@ impeller_component("vulkan") {
9697
"//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers",
9798
"//third_party/vulkan_memory_allocator",
9899
]
100+
101+
if (enable_vulkan_validation_layers) {
102+
defines = [ "IMPELLER_ENABLE_VULKAN_VALIDATION_LAYERS" ]
103+
}
99104
}

impeller/renderer/backend/vulkan/context_vk.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ void ContextVK::Setup(Settings settings) {
184184

185185
vk::InstanceCreateInfo instance_info;
186186
if (caps->AreValidationsEnabled()) {
187+
std::stringstream ss;
188+
ss << "Enabling validation layers, features: [";
189+
for (const auto& validation : enabled_validations) {
190+
ss << vk::to_string(validation) << " ";
191+
}
192+
ss << "]";
193+
FML_LOG(ERROR) << ss.str();
194+
#if !defined(IMPELLER_ENABLE_VULKAN_VALIDATION_LAYERS) && FML_OS_ANDROID
195+
FML_LOG(ERROR) << "Vulkan validation layers turned on but the gn argument "
196+
"`--enable-vulkan-validation-layers` is missing.";
197+
#endif
187198
instance_info.pNext = &validation;
188199
}
189200
instance_info.setPEnabledLayerNames(enabled_layers_c);

0 commit comments

Comments
 (0)