Debian Codegraph @

include/gpu/ganesh/vk/GrBackendDrawableInfo.h

raw
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/ganesh/GrTypes.h"
12
13 #include "include/gpu/ganesh/vk/GrVkTypes.h"
14
15 // If necessary, this could be pulled into a generic interface, but at this point, we only expect
16 // it to be used by the Ganesh Vulkan backend.
17 class SK_API GrBackendDrawableInfo {
18 public:
19 // Creates an invalid backend drawable info.
20 GrBackendDrawableInfo() : fIsValid(false) {}
21
22 explicit GrBackendDrawableInfo(const GrVkDrawableInfo& info)
23 : fIsValid(true), fBackend(GrBackendApi::kVulkan), 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