Link to vulkan in tools but not library.
This also now requires an explicit vulkan proc address getter to be used with GrVkBackendContext::Create. Change-Id: I768ec487398dab68e6e10409419ac7a00ec1822a Reviewed-on: https://skia-review.googlesource.com/14322 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
78de212909
commit
5db010bfb5
15
BUILD.gn
15
BUILD.gn
@ -41,7 +41,6 @@ declare_args() {
|
||||
skia_enable_tools = is_skia_dev_build
|
||||
skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
|
||||
skia_vulkan_sdk = getenv("VULKAN_SDK")
|
||||
skia_link_with_vulkan = !is_fuchsia
|
||||
}
|
||||
declare_args() {
|
||||
skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
|
||||
@ -167,15 +166,6 @@ config("skia_private") {
|
||||
lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (skia_link_with_vulkan) {
|
||||
defines += [ "SK_LINK_WITH_VULKAN" ]
|
||||
if (is_win) {
|
||||
libs += [ "vulkan-1.lib" ]
|
||||
} else {
|
||||
libs += [ "vulkan" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
if (skia_enable_gpu) {
|
||||
include_dirs += [ "src/gpu" ]
|
||||
@ -911,6 +901,11 @@ if (skia_enable_tools) {
|
||||
}
|
||||
if (skia_use_vulkan) {
|
||||
sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
|
||||
if (is_win) {
|
||||
libs += [ "vulkan-1.lib" ]
|
||||
} else {
|
||||
libs += [ "vulkan" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,10 +56,8 @@ struct GrVkBackendContext : public SkRefCnt {
|
||||
|
||||
/**
|
||||
* Helper function to create the Vulkan objects needed for a Vulkan-backed GrContext.
|
||||
* If getProc is null, a default getProc will be constructed if we are statically linking
|
||||
* against Vulkan. Note that this default behavior will be removed soon as well as the version
|
||||
* that uses the unified "GetProc" instead of separate "GetInstanceProc" and "GetDeviceProc"
|
||||
* functions.
|
||||
* Note that the version that uses the unified "GetProc" instead of separate "GetInstanceProc"
|
||||
* and "GetDeviceProc" functions will be removed.
|
||||
*
|
||||
* If presentQueueIndex is non-NULL, will try to set up presentQueue as part of device
|
||||
* creation using the platform-specific canPresent() function.
|
||||
@ -75,6 +73,9 @@ struct GrVkBackendContext : public SkRefCnt {
|
||||
const GrVkInterface::GetDeviceProc& getDeviceProc,
|
||||
uint32_t* presentQueueIndex = nullptr,
|
||||
CanPresentFn canPresent = CanPresentFn()) {
|
||||
if (!getInstanceProc || !getDeviceProc) {
|
||||
return nullptr;
|
||||
}
|
||||
auto getProc = [&getInstanceProc, &getDeviceProc](const char* proc_name,
|
||||
VkInstance instance, VkDevice device) {
|
||||
if (device != VK_NULL_HANDLE) {
|
||||
|
@ -51,12 +51,7 @@ const GrVkBackendContext* GrVkBackendContext::Create(uint32_t* presentQueueIndex
|
||||
CanPresentFn canPresent,
|
||||
GrVkInterface::GetProc getProc) {
|
||||
if (!getProc) {
|
||||
#ifdef SK_LINK_WITH_VULKAN
|
||||
return GrVkBackendContext::Create(vkGetInstanceProcAddr, vkGetDeviceProcAddr,
|
||||
presentQueueIndexPtr, canPresent);
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
SkASSERT(getProc);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user