Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/include/android_stub/hardware/hwvulkan.h
7202 views
1
/*
2
* Copyright 2015 The Android Open Source Project
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#ifndef ANDROID_HWVULKAN_H
18
#define ANDROID_HWVULKAN_H
19
20
#include <hardware/hardware.h>
21
#include <vulkan/vulkan.h>
22
23
__BEGIN_DECLS
24
25
#define HWVULKAN_HARDWARE_MODULE_ID "vulkan"
26
27
#define HWVULKAN_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
28
#define HWVULKAN_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION_2(0, 1, 0)
29
30
#define HWVULKAN_DEVICE_0 "vk0"
31
32
typedef struct hwvulkan_module_t {
33
struct hw_module_t common;
34
} hwvulkan_module_t;
35
36
/* Dispatchable Vulkan object handles must be pointers, which must point to
37
* instances of hwvulkan_dispatch_t (potentially followed by additional
38
* implementation-defined data). On return from the creation function, the
39
* 'magic' field must contain HWVULKAN_DISPATCH_MAGIC; the loader will overwrite
40
* the 'vtbl' field.
41
*
42
* NOTE: The magic value and the layout of hwvulkan_dispatch_t match the LunarG
43
* loader used on platforms, to avoid pointless annoying differences for
44
* multi-platform drivers. Don't change them without a good reason. If there is
45
* an opportunity to change it, using a magic value that doesn't leave the
46
* upper 32-bits zero on 64-bit platforms would be nice.
47
*/
48
#define HWVULKAN_DISPATCH_MAGIC 0x01CDC0DE
49
typedef union {
50
uintptr_t magic;
51
const void* vtbl;
52
} hwvulkan_dispatch_t;
53
54
/* A hwvulkan_device_t corresponds to an ICD on other systems. Currently there
55
* can only be one on a system (HWVULKAN_DEVICE_0). It is opened once per
56
* process when the Vulkan API is first used; the hw_device_t::close() function
57
* is never called. Any non-trivial resource allocation should be done when
58
* the VkInstance is created rather than when the hwvulkan_device_t is opened.
59
*/
60
typedef struct hwvulkan_device_t {
61
struct hw_device_t common;
62
63
PFN_vkEnumerateInstanceExtensionProperties
64
EnumerateInstanceExtensionProperties;
65
PFN_vkCreateInstance CreateInstance;
66
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
67
} hwvulkan_device_t;
68
69
__END_DECLS
70
71
#endif // ANDROID_HWVULKAN_H
72
73