• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 Google LLC
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 skgpu_BackendTexture_DEFINED
9 #define skgpu_BackendTexture_DEFINED
10 
11 #include "experimental/graphite/include/GraphiteTypes.h"
12 #include "experimental/graphite/include/TextureInfo.h"
13 #include "include/core/SkSize.h"
14 
15 #ifdef SK_METAL
16 #include "experimental/graphite/include/mtl/MtlTypes.h"
17 #endif
18 
19 namespace skgpu {
20 
21 class BackendTexture {
22 public:
23 #ifdef SK_METAL
24     BackendTexture(SkISize dimensions, sk_cfp<mtl::Handle> mtlTexture);
25 #endif
26 
isValid()27     bool isValid() const { return fInfo.isValid(); }
backend()28     BackendApi backend() const { return fInfo.backend(); }
29 
dimensions()30     SkISize dimensions() const { return fDimensions; }
31 
32 private:
33     SkISize fDimensions;
34     TextureInfo fInfo;
35 
36     union {
37 #ifdef SK_METAL
38         sk_cfp<mtl::Handle> fMtlTexture;
39 #endif
40     };
41 };
42 
43 } // namespace skgpu
44 
45 #endif // skgpu_BackendTexture_DEFINED
46 
47