1 /* 2 * Copyright 2018 Google LLC 3 * SPDX-License-Identifier: MIT 4 */ 5 #include "VulkanHandleMapping.h" 6 7 #include <vulkan/vulkan.h> 8 9 namespace gfxstream { 10 namespace vk { 11 12 #define DEFAULT_HANDLE_MAP_DEFINE(type) \ 13 void DefaultHandleMapping::mapHandles_##type(type*, size_t) { return; } \ 14 void DefaultHandleMapping::mapHandles_##type##_u64(const type* handles, uint64_t* handle_u64s, \ 15 size_t count) { \ 16 for (size_t i = 0; i < count; ++i) { \ 17 handle_u64s[i] = (uint64_t)(uintptr_t)handles[i]; \ 18 } \ 19 } \ 20 void DefaultHandleMapping::mapHandles_u64_##type(const uint64_t* handle_u64s, type* handles, \ 21 size_t count) { \ 22 for (size_t i = 0; i < count; ++i) { \ 23 handles[i] = (type)(uintptr_t)handle_u64s[i]; \ 24 } \ 25 } 26 27 GOLDFISH_VK_LIST_HANDLE_TYPES(DEFAULT_HANDLE_MAP_DEFINE) 28 29 } // namespace vk 30 } // namespace gfxstream 31