• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2018 The Android Open Source Project
2# Copyright (c) 2018 Google Inc.
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
16from .common.codegen import VulkanWrapperGenerator
17from .common.vulkantypes import makeVulkanTypeSimple
18
19# Contains definitions for various Vulkan API wrappers. This information is
20# shared to make it easier for one kind of wrapper to know how to call
21# another one.
22
23API_PREFIX_MARSHAL = "marshal_"
24API_PREFIX_UNMARSHAL = "unmarshal_"
25API_PREFIX_RESERVEDMARSHAL = "reservedmarshal_"
26API_PREFIX_RESERVEDUNMARSHAL = "reservedunmarshal_"
27
28MARSHAL_INPUT_VAR_NAME = "forMarshaling"
29UNMARSHAL_INPUT_VAR_NAME = "forUnmarshaling"
30
31API_PREFIX_VALIDATE = "validate_"
32API_PREFIX_FRONTEND = "goldfish_frontend_"
33
34VULKAN_STREAM_TYPE = "VulkanStream"
35VULKAN_STREAM_TYPE_GUEST = "VulkanStreamGuest"
36VULKAN_STREAM_VAR_NAME = "vkStream"
37
38VALIDATE_RESULT_TYPE = "VkResult"
39VALIDATE_VAR_NAME = "validateResult"
40VALIDATE_GOOD_RESULT = "VK_SUCCESS"
41
42ROOT_TYPE_VAR_NAME = "rootType"
43ROOT_TYPE_DEFAULT_VALUE = "VK_STRUCTURE_TYPE_MAX_ENUM"
44ROOT_TYPE_TYPE = "VkStructureType"
45ROOT_TYPE_PARAM = makeVulkanTypeSimple(
46    False, ROOT_TYPE_TYPE, 0, ROOT_TYPE_VAR_NAME)
47
48PARAMETERS_MARSHALING = [
49    makeVulkanTypeSimple(False, VULKAN_STREAM_TYPE, 1, VULKAN_STREAM_VAR_NAME),
50    ROOT_TYPE_PARAM,
51]
52PARAMETERS_MARSHALING_GUEST = [
53    makeVulkanTypeSimple(False, VULKAN_STREAM_TYPE_GUEST,
54                         1, VULKAN_STREAM_VAR_NAME),
55    ROOT_TYPE_PARAM,
56]
57PARAMETERS_VALIDATE = [
58    makeVulkanTypeSimple(False, VALIDATE_RESULT_TYPE, 1, VALIDATE_VAR_NAME)
59]
60PARAMETERS_COUNTING = [
61    makeVulkanTypeSimple(False, "size_t", 1, VULKAN_STREAM_VAR_NAME)
62]
63
64STRUCT_EXTENSION_PARAM = \
65    makeVulkanTypeSimple(True, "void", 1, "structExtension")
66
67STRUCT_EXTENSION_PARAM2 = \
68    makeVulkanTypeSimple(True, "void", 1, "structExtension2")
69
70STRUCT_EXTENSION_PARAM_FOR_WRITE = \
71    makeVulkanTypeSimple(False, "void", 1, "structExtension_out")
72
73STRUCT_TYPE_API_NAME = "goldfish_vk_struct_type"
74EXTENSION_SIZE_API_NAME = "goldfish_vk_extension_struct_size"
75EXTENSION_SIZE_WITH_STREAM_FEATURES_API_NAME = "goldfish_vk_extension_struct_size_with_stream_features"
76
77VOID_TYPE = makeVulkanTypeSimple(False, "void", 0)
78STREAM_RET_TYPE = makeVulkanTypeSimple(False, "void", 0)
79
80API_PREFIX_EQUALITY = "checkEqual_"
81EQUALITY_VAR_NAMES = ["a", "b"]
82EQUALITY_ON_FAIL_VAR = "onFail"
83EQUALITY_ON_FAIL_VAR_TYPE = makeVulkanTypeSimple(False, "OnFailCompareFunc", 0,
84                                                 EQUALITY_ON_FAIL_VAR)
85EQUALITY_RET_TYPE = makeVulkanTypeSimple(False, "void", 0)
86
87RELAXED_APIS = [
88    "vkWaitForFences",
89    "vkWaitSemaphores",
90    "vkWaitSemaphoresKHR",
91    "vkQueueWaitIdle",
92    "vkDeviceWaitIdle",
93    "vkQueueFlushCommandsGOOGLE",
94]
95
96STYPE_OVERRIDE = {
97    "VkPhysicalDeviceFragmentDensityMapFeaturesEXT": "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT",
98    "VkPhysicalDeviceFragmentDensityMapPropertiesEXT": "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT",
99    "VkRenderPassFragmentDensityMapCreateInfoEXT": "VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT",
100    "VkImportColorBufferGOOGLE": "VK_STRUCTURE_TYPE_IMPORT_COLOR_BUFFER_GOOGLE",
101    "VkImportBufferGOOGLE": "VK_STRUCTURE_TYPE_IMPORT_BUFFER_GOOGLE",
102    "VkCreateBlobGOOGLE": "VK_STRUCTURE_TYPE_CREATE_BLOB_GOOGLE",
103}
104
105MAX_PACKET_LENGTH = "(400 * 1024 * 1024) // 400MB"
106
107
108
109