1 /* 2 * Copyright 2017 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 GrMtlTypes_DEFINED 9 #define GrMtlTypes_DEFINED 10 11 #include "include/gpu/GrTypes.h" 12 #include "include/ports/SkCFObject.h" 13 14 /** 15 * Declares typedefs for Metal types used in Ganesh cpp code 16 */ 17 typedef unsigned int GrMTLPixelFormat; 18 typedef const void* GrMTLHandle; 19 20 /////////////////////////////////////////////////////////////////////////////// 21 22 #ifdef __APPLE__ 23 24 #include <TargetConditionals.h> 25 26 #if TARGET_OS_SIMULATOR 27 #define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0)) 28 #else // TARGET_OS_SIMULATOR 29 #define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0)) 30 #endif // TARGET_OS_SIMULATOR 31 32 /** 33 * Types for interacting with Metal resources created externally to Skia. 34 * This is used by GrBackendObjects. 35 */ 36 struct GrMtlTextureInfo { 37 public: GrMtlTextureInfoGrMtlTextureInfo38 GrMtlTextureInfo() {} 39 40 sk_cfp<GrMTLHandle> fTexture; 41 42 bool operator==(const GrMtlTextureInfo& that) const { 43 return fTexture == that.fTexture; 44 } 45 }; 46 47 #endif 48 49 #endif 50