1 // Copyright (C) 2018 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #pragma once 15 16 #include <hardware/hwvulkan.h> 17 #include <vulkan/vulkan.h> 18 19 #include "VulkanHandles.h" 20 21 #include <inttypes.h> 22 23 extern "C" { 24 25 #define GOLDFISH_VK_DEFINE_DISPATCHABLE_HANDLE_STRUCT(type) \ 26 struct goldfish_##type { \ 27 hwvulkan_dispatch_t dispatch; \ 28 uint64_t underlying; \ 29 }; \ 30 31 #define GOLDFISH_VK_DEFINE_TRIVIAL_NON_DISPATCHABLE_HANDLE_STRUCT(type) \ 32 struct goldfish_##type { \ 33 uint64_t underlying; \ 34 }; \ 35 36 #define GOLDFISH_VK_NEW_FROM_HOST_DECL(type) \ 37 type new_from_host_##type(type); 38 39 #define GOLDFISH_VK_AS_GOLDFISH_DECL(type) \ 40 struct goldfish_##type* as_goldfish_##type(type); 41 42 #define GOLDFISH_VK_GET_HOST_DECL(type) \ 43 type get_host_##type(type); 44 45 #define GOLDFISH_VK_DELETE_GOLDFISH_DECL(type) \ 46 void delete_goldfish_##type(type); 47 48 #define GOLDFISH_VK_IDENTITY_DECL(type) \ 49 type vk_handle_identity_##type(type); 50 51 #define GOLDFISH_VK_NEW_FROM_HOST_U64_DECL(type) \ 52 type new_from_host_u64_##type(uint64_t); 53 54 #define GOLDFISH_VK_GET_HOST_U64_DECL(type) \ 55 uint64_t get_host_u64_##type(type); 56 57 GOLDFISH_VK_LIST_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_DEFINE_DISPATCHABLE_HANDLE_STRUCT) 58 GOLDFISH_VK_LIST_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_NEW_FROM_HOST_DECL) 59 GOLDFISH_VK_LIST_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_AS_GOLDFISH_DECL) 60 GOLDFISH_VK_LIST_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_GET_HOST_DECL) 61 GOLDFISH_VK_LIST_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_DELETE_GOLDFISH_DECL) 62 GOLDFISH_VK_LIST_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_IDENTITY_DECL) 63 GOLDFISH_VK_LIST_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_NEW_FROM_HOST_U64_DECL) 64 GOLDFISH_VK_LIST_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_GET_HOST_U64_DECL) 65 66 GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_NEW_FROM_HOST_DECL) 67 GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_AS_GOLDFISH_DECL) 68 GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_GET_HOST_DECL) 69 GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_DELETE_GOLDFISH_DECL) 70 GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_IDENTITY_DECL) 71 GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_NEW_FROM_HOST_U64_DECL) 72 GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_GET_HOST_U64_DECL) 73 GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(GOLDFISH_VK_DEFINE_TRIVIAL_NON_DISPATCHABLE_HANDLE_STRUCT) 74 75 } // extern "C" 76