Flutter Engine
The Flutter Engine
GraphiteResourceKey.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 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_graphite_GraphiteResourceKey_DEFINED
9#define skgpu_graphite_GraphiteResourceKey_DEFINED
10
11#include "src/gpu/ResourceKey.h"
13
14namespace skgpu::graphite {
15
17public:
18 /** Generate a unique ResourceType. */
20
21 /** Creates an invalid key. It must be initialized using a Builder object before use. */
22 GraphiteResourceKey() : fShareable(Shareable::kNo) {}
23
24 GraphiteResourceKey(const GraphiteResourceKey& that) { *this = that; }
25
26 /** reset() returns the key to the invalid state. */
28
30
31 ResourceType resourceType() const { return this->domain(); }
32
33 Shareable shareable() const { return fShareable; }
34
36 this->ResourceKey::operator=(that);
37 fShareable = that.fShareable;
38 return *this;
39 }
40
41 bool operator==(const GraphiteResourceKey& that) const {
42 bool result = this->ResourceKey::operator==(that);
43 SkASSERT(!result || (result == (fShareable == that.fShareable)));
44 return result;
45 }
46 bool operator!=(const GraphiteResourceKey& that) const {
47 return !(*this == that);
48 }
49
51 public:
53 : ResourceKey::Builder(key, type, data32Count) {
54 key->fShareable = shareable;
55 }
56 };
57
58private:
59 Shareable fShareable;
60};
61
62} // namespace skgpu::graphite
63
64#endif // skgpu_graphite_GraphiteResourceKey_DEFINED
#define SkASSERT(cond)
Definition: SkAssert.h:116
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
GLenum type
bool isValid() const
Definition: ResourceKey.h:55
ResourceKey & operator=(const ResourceKey &that)
Definition: ResourceKey.h:106
uint32_t domain() const
Definition: ResourceKey.h:121
bool operator==(const ResourceKey &that) const
Definition: ResourceKey.h:99
Builder(GraphiteResourceKey *key, ResourceType type, int data32Count, Shareable shareable)
GraphiteResourceKey(const GraphiteResourceKey &that)
bool operator!=(const GraphiteResourceKey &that) const
GraphiteResourceKey & operator=(const GraphiteResourceKey &that)
bool operator==(const GraphiteResourceKey &that) const
GAsyncResult * result
uint32_t ResourceType