1fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot/* 2fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot * Copyright 2017 Google Inc. 3fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot * 4fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot * Use of this source code is governed by a BSD-style license that can be 5fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot * found in the LICENSE file. 6fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot */ 7fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 8fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot#include "VkTestUtils.h" 9fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 10fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot#ifdef SK_VULKAN 11fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 12fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot#include "../ports/SkOSLibrary.h" 13fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 14fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotnamespace sk_gpu_test { 15fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 16fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotbool LoadVkLibraryAndGetProcAddrFuncs(PFN_vkGetInstanceProcAddr* instProc, 17fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot PFN_vkGetDeviceProcAddr* devProc) { 18fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot static void* vkLib = nullptr; 19fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot static PFN_vkGetInstanceProcAddr localInstProc = nullptr; 20fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot static PFN_vkGetDeviceProcAddr localDevProc = nullptr; 21fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if (!vkLib) { 22fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot#if defined _WIN32 23fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot vkLib = DynamicLoadLibrary("vulkan-1.dll"); 24fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot#else 25fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot vkLib = DynamicLoadLibrary("libvulkan.so"); 26fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot#endif 27fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if (!vkLib) { 28fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot return false; 29fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot } 30fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot localInstProc = (PFN_vkGetInstanceProcAddr) GetProcedureAddress(vkLib, 31fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot "vkGetInstanceProcAddr"); 32fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot localDevProc = (PFN_vkGetDeviceProcAddr) GetProcedureAddress(vkLib, 33fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot "vkGetDeviceProcAddr"); 34fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot } 35fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if (!localInstProc || !localDevProc) { 36fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot return false; 37fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot } 38fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot *instProc = localInstProc; 39fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot *devProc = localDevProc; 40fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot return true; 41fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot} 42fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot} 43fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 44fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot#endif 45