1 /* 2 * Copyright 2015 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 #ifndef GrVkUtil_DEFINED 9 #define GrVkUtil_DEFINED 10 11 #include "GrColor.h" 12 #include "GrTypes.h" 13 #include "vk/GrVkInterface.h" 14 15 #include "vulkan/vulkan.h" 16 17 // makes a Vk call on the interface 18 #define GR_VK_CALL(IFACE, X) (IFACE)->fFunctions.f##X; 19 // same as GR_VK_CALL but checks for success 20 #ifdef SK_DEBUG 21 #define GR_VK_CALL_ERRCHECK(IFACE, X) \ 22 VkResult SK_MACRO_APPEND_LINE(ret) = GR_VK_CALL(IFACE, X); \ 23 SkASSERT(VK_SUCCESS == SK_MACRO_APPEND_LINE(ret)); 24 #else 25 #define GR_VK_CALL_ERRCHECK(IFACE, X) (void) GR_VK_CALL(IFACE, X); 26 #endif 27 28 /** 29 * Returns the vulkan texture format for the given GrPixelConfig 30 */ 31 bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format); 32 33 bool GrSampleCountToVkSampleCount(uint32_t samples, VkSampleCountFlagBits* vkSamples); 34 35 #endif 36 37