skia2/tools/gpu/vk/VkTestUtils.cpp
Greg Daniel 35970ec0c8 Revert "Revert "Dynamically load the vulkan library in our test tools""
This reverts commit c8dd283c9a.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "Dynamically load the vulkan library in our test tools"
> 
> This reverts commit 77d6feaa69.
> 
> Reason for revert: breaking google 3
> 
> Original change's description:
> > Dynamically load the vulkan library in our test tools
> > 
> > Bug: skia:
> > Change-Id: I7c1f6cbb2b50ca284f40cf4b9ef49a76083b38c6
> > Reviewed-on: https://skia-review.googlesource.com/68643
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,csmartdalton@google.com
> 
> Change-Id: I6b2588e71f1876868fcf8f2b3c91a96e7c689045
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/69780
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,csmartdalton@google.com

Change-Id: I758aec07114305f0add086eecb1deb94d0140dcf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/69900
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2017-11-10 15:04:08 +00:00

45 lines
1.3 KiB
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "VkTestUtils.h"
#ifdef SK_VULKAN
#include "../ports/SkOSLibrary.h"
namespace sk_gpu_test {
bool LoadVkLibraryAndGetProcAddrFuncs(PFN_vkGetInstanceProcAddr* instProc,
PFN_vkGetDeviceProcAddr* devProc) {
static void* vkLib = nullptr;
static PFN_vkGetInstanceProcAddr localInstProc = nullptr;
static PFN_vkGetDeviceProcAddr localDevProc = nullptr;
if (!vkLib) {
#if defined _WIN32
vkLib = DynamicLoadLibrary("vulkan-1.dll");
#else
vkLib = DynamicLoadLibrary("libvulkan.so");
#endif
if (!vkLib) {
return false;
}
localInstProc = (PFN_vkGetInstanceProcAddr) GetProcedureAddress(vkLib,
"vkGetInstanceProcAddr");
localDevProc = (PFN_vkGetDeviceProcAddr) GetProcedureAddress(vkLib,
"vkGetDeviceProcAddr");
}
if (!localInstProc || !localDevProc) {
return false;
}
*instProc = localInstProc;
*devProc = localDevProc;
return true;
}
}
#endif