Home | History | Annotate | Download | only in gpu
      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 "GrTypes.h"
     12 
     13 #include "vk/GrVkTypes.h"
     14 
     15 class SK_API GrBackendDrawableInfo {
     16 public:
     17     // Creates an invalid backend drawable info.
     18     GrBackendDrawableInfo() : fIsValid(false) {}
     19 
     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.
     26     bool isValid() const { return fIsValid; }
     27 
     28     GrBackendApi backend() const { return fBackend; }
     29 
     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