1 /* 2 * Copyright 2018 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 // We use this header to include vk_mem_alloc.h to make sure we always include GrVkDefines.h first. 9 // We need to do this so that the corect defines are setup before we include vulkan.h inside of 10 // vk_mem_alloc.h 11 12 #ifndef GrVulkanMemoryAllocator_DEFINED 13 #define GrVulkanMemoryAllocator_DEFINED 14 15 // We only ever include this from src files which have already included vulkan. 16 #ifndef VULKAN_CORE_H_ 17 #error "vulkan_core.h has not been included before trying to include the GrVulkanMemoryAllocator" 18 #endif 19 20 // TODO: We currently lock down our API to Vulkan 1.1. When we update Skia to support 1.3 then we 21 // can remove this macro. We should also update the setting of the API level in the vma createInfo 22 // struct when we do this 23 #define VMA_VULKAN_VERSION 1001000 24 25 // vk_mem_alloc.h checks to see if VULKAN_H_ has been included before trying to include vulkan.h. 26 // However, some builds of Skia may not have access to vulkan.h and just have access to 27 // vulkan_core.h. So we pretend we've already included vulkan.h (if it already hasn't been) which 28 // will be fine for building internal skia files. If we do fake it out by defining VULKAN_H_ we 29 // need to make sure to undefine it incase outside client code does later try to include the 30 // real vulkan.h 31 #ifndef VULKAN_H_ 32 #define VULKAN_H_ 33 #define GR_NEEDED_TO_DEFINE_VULKAN_H 34 #endif 35 #include "vk_mem_alloc.h" 36 #ifdef GR_NEEDED_TO_DEFINE_VULKAN_H 37 #undef VULKAN_H_ 38 #endif 39 40 #endif 41