Skip to content

Commit 590a245

Browse files
committed
chinmays vulkan patch
1 parent 6b089df commit 590a245

File tree

4 files changed

+32
-15
lines changed

4 files changed

+32
-15
lines changed

impeller/BUILD.gn

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ config("impeller_public_config") {
3434
defines += [ "IMPELLER_ENABLE_VULKAN=1" ]
3535
}
3636

37-
if (impeller_enable_vulkan_playgrounds) {
38-
defines += [ "IMPELLER_ENABLE_VULKAN_PLAYGROUNDS=1" ]
39-
}
40-
4137
if (impeller_trace_all_gl_calls) {
4238
defines += [ "IMPELLER_TRACE_ALL_GL_CALLS" ]
4339
}

impeller/playground/backend/vulkan/playground_impl_vk.cc

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,38 @@ void PlaygroundImplVK::InitGlobalVulkanInstance() {
175175
application_info.setPEngineName("PlaygroundImplVK");
176176
application_info.setPApplicationName("PlaygroundImplVK");
177177

178-
auto instance_result =
179-
vk::createInstanceUnique(vk::InstanceCreateInfo({}, &application_info));
178+
CapabilitiesVK caps(false);
179+
auto enabled_layers = caps.GetEnabledLayers();
180+
auto enabled_extensions = caps.GetEnabledInstanceExtensions();
181+
182+
FML_CHECK(enabled_layers.has_value() && enabled_extensions.has_value());
183+
184+
std::vector<const char*> enabled_layers_c;
185+
std::vector<const char*> enabled_extensions_c;
186+
187+
for (const auto& layer : enabled_layers.value()) {
188+
enabled_layers_c.push_back(layer.c_str());
189+
}
190+
191+
for (const auto& ext : enabled_extensions.value()) {
192+
enabled_extensions_c.push_back(ext.c_str());
193+
}
194+
195+
vk::InstanceCreateInfo instance_info;
196+
instance_info.setPEnabledLayerNames(enabled_layers_c);
197+
instance_info.setPEnabledExtensionNames(enabled_extensions_c);
198+
instance_info.setPApplicationInfo(&application_info);
199+
200+
if (std::find(enabled_extensions->begin(), enabled_extensions->end(),
201+
"VK_KHR_portability_enumeration") !=
202+
enabled_extensions->end()) {
203+
instance_info.flags |= vk::InstanceCreateFlagBits::eEnumeratePortabilityKHR;
204+
}
205+
206+
auto instance_result = vk::createInstanceUnique(instance_info);
180207
FML_CHECK(instance_result.result == vk::Result::eSuccess)
181-
<< "Unable to initialize global Vulkan instance";
208+
<< "Unable to initialize global Vulkan instance: "
209+
<< vk::to_string(instance_result.result);
182210
global_instance_ = std::move(instance_result.value);
183211
}
184212

impeller/playground/playground.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool Playground::SupportsBackend(PlaygroundBackend backend) {
102102
return false;
103103
#endif // IMPELLER_ENABLE_OPENGLES
104104
case PlaygroundBackend::kVulkan:
105-
#if IMPELLER_ENABLE_VULKAN && IMPELLER_ENABLE_VULKAN_PLAYGROUNDS
105+
#if IMPELLER_ENABLE_VULKAN
106106
return true;
107107
#else // IMPELLER_ENABLE_VULKAN
108108
return false;

impeller/tools/impeller.gni

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ declare_args() {
2525
impeller_enable_vulkan = (is_linux || is_win || is_android ||
2626
enable_unittests) && target_os != "fuchsia"
2727

28-
# Whether playgrounds should run with Vulkan.
29-
#
30-
# impeller_enable_vulkan may be true in build environments that run tests but
31-
# do not have a Vulkan ICD present.
32-
impeller_enable_vulkan_playgrounds =
33-
(is_linux || is_win || is_android) && target_os != "fuchsia"
34-
3528
# Whether to use a prebuilt impellerc.
3629
# If this is the empty string, impellerc will be built.
3730
# If it is non-empty, it should be the absolute path to impellerc.

0 commit comments

Comments
 (0)