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 #ifndef GrBackendDrawableInfo_DEFINED 9 #define GrBackendDrawableInfo_DEFINED 10 11 #include "include/gpu/GrTypes.h" 12 13 #include "include/gpu/vk/GrVkTypes.h" 14 15 class SK_API GrBackendDrawableInfo { 16 public: 17 // Creates an invalid backend drawable info. GrBackendDrawableInfo()18 GrBackendDrawableInfo() : fIsValid(false) {} 19 GrBackendDrawableInfo(const GrVkDrawableInfo & info)20 GrBackendDrawableInfo(const GrVkDrawableInfo& info) 21 : fIsValid(true) 22 , fBackend(GrBackendApi::kVulkan) 23 , fVkInfo(info) {} 24 25 // Returns true if the backend texture has been initialized. isValid()26 bool isValid() const { return fIsValid; } 27 backend()28 GrBackendApi backend() const { return fBackend; } 29 getVkDrawableInfo(GrVkDrawableInfo * outInfo)30 bool getVkDrawableInfo(GrVkDrawableInfo* outInfo) const { 31 if (this->isValid() && GrBackendApi::kVulkan == fBackend) { 32 *outInfo = fVkInfo; 33 return true; 34 } 35 return false; 36 } 37 38 private: 39 bool fIsValid; 40 GrBackendApi fBackend; 41 GrVkDrawableInfo fVkInfo; 42 }; 43 44 #endif 45