Statically link swiftshader into flutter_tester (flutter/engine#48708)

Depends on https://swiftshader-review.googlesource.com/c/SwiftShader/+/72768

Fixes https://github.com/flutter/flutter/issues/138169
This commit is contained in:
Dan Field 2023-12-15 16:47:57 -08:00 committed by GitHub
parent 7c532f1ab8
commit 19726b1650
3 changed files with 2 additions and 11 deletions

View File

@ -50,7 +50,7 @@ executable("testing") {
deps += [
":tester_gpu_configuration",
"//flutter/impeller",
"//flutter/third_party/swiftshader",
"//flutter/third_party/swiftshader/src/Vulkan:swiftshader_libvulkan_static",
]
}

View File

@ -35,7 +35,6 @@
#if ALLOW_IMPELLER
#include <vulkan/vulkan.h> // nogncheck
#include "flutter/vulkan/procs/vulkan_proc_table.h" // nogncheck
#include "flutter/vulkan/swiftshader_path.h" // nogncheck
#include "impeller/entity/vk/entity_shaders_vk.h" // nogncheck
#include "impeller/entity/vk/framebuffer_blend_shaders_vk.h" // nogncheck
#include "impeller/entity/vk/modern_shaders_vk.h" // nogncheck
@ -78,7 +77,7 @@ struct ImpellerVulkanContextHolder {
bool ImpellerVulkanContextHolder::Initialize(bool enable_validation) {
vulkan_proc_table =
fml::MakeRefCounted<vulkan::VulkanProcTable>(VULKAN_SO_PATH);
fml::MakeRefCounted<vulkan::VulkanProcTable>(&vkGetInstanceProcAddr);
if (!vulkan_proc_table->NativeGetInstanceProcAddr()) {
FML_LOG(ERROR) << "Could not load Swiftshader library.";
return false;

View File

@ -76,13 +76,9 @@ PFN_vkGetInstanceProcAddr VulkanProcTable::NativeGetInstanceProcAddr() const {
return GetInstanceProcAddr;
}
#if VULKAN_LINK_STATICALLY
return &vkGetInstanceProcAddr;
#else // VULKAN_LINK_STATICALLY
auto instance_proc =
const_cast<uint8_t*>(handle_->ResolveSymbol("vkGetInstanceProcAddr"));
return reinterpret_cast<PFN_vkGetInstanceProcAddr>(instance_proc);
#endif // VULKAN_LINK_STATICALLY
}
bool VulkanProcTable::SetupLoaderProcAddresses() {
@ -200,11 +196,7 @@ bool VulkanProcTable::SetupDeviceProcAddresses(
}
bool VulkanProcTable::OpenLibraryHandle(const char* path) {
#if VULKAN_LINK_STATICALLY
handle_ = fml::NativeLibrary::CreateForCurrentProcess();
#else // VULKAN_LINK_STATICALLY
handle_ = fml::NativeLibrary::Create(path);
#endif // VULKAN_LINK_STATICALLY
if (!handle_) {
FML_DLOG(ERROR) << "Could not open Vulkan library handle: " << path;
return false;