Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/virtio/vulkan/vn_icd.c
4560 views
1
/*
2
* Copyright 2019 Google LLC
3
* SPDX-License-Identifier: MIT
4
*
5
* based in part on anv and radv which are:
6
* Copyright © 2015 Intel Corporation
7
* Copyright © 2016 Red Hat.
8
* Copyright © 2016 Bas Nieuwenhuizen
9
*/
10
11
#include "vn_icd.h"
12
13
#include "vn_device.h"
14
15
/* we support all versions from version 1 up to version 5 */
16
static uint32_t vn_icd_version = 5;
17
18
VkResult
19
vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pSupportedVersion)
20
{
21
vn_debug_init();
22
23
vn_icd_version = MIN2(vn_icd_version, *pSupportedVersion);
24
if (VN_DEBUG(INIT))
25
vn_log(NULL, "using ICD interface version %d", vn_icd_version);
26
27
*pSupportedVersion = vn_icd_version;
28
return VK_SUCCESS;
29
}
30
31
PFN_vkVoidFunction
32
vk_icdGetInstanceProcAddr(VkInstance instance, const char *pName)
33
{
34
return vn_GetInstanceProcAddr(instance, pName);
35
}
36
37
PFN_vkVoidFunction
38
vk_icdGetPhysicalDeviceProcAddr(VkInstance _instance, const char *pName)
39
{
40
struct vn_instance *instance = vn_instance_from_handle(_instance);
41
return vk_instance_get_physical_device_proc_addr(&instance->base.base,
42
pName);
43
}
44
45
bool
46
vn_icd_supports_api_version(uint32_t api_version)
47
{
48
return vn_icd_version >= 5 || api_version < VK_API_VERSION_1_1;
49
}
50
51