diff options
author | 2015-01-23 04:24:04 -0800 | |
---|---|---|
committer | 2015-01-23 04:24:05 -0800 | |
commit | 24db3b1c35fb935660229da164fc5ad31977387f (patch) | |
tree | be22e794f54605ff37ef09df79b3e0869572b053 /include/gpu/GrTypes.h | |
parent | f98f2bb0e72df68320f707c8584e3c877ce98ec3 (diff) |
Add specialized content key class for resources.
Review URL: https://codereview.chromium.org/858123002
Diffstat (limited to 'include/gpu/GrTypes.h')
-rw-r--r-- | include/gpu/GrTypes.h | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index c4e374fdf2..f4fb3ab43f 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -473,58 +473,6 @@ struct GrSurfaceDesc { typedef GrSurfaceDesc GrTextureDesc; /** - * GrCacheID is used create and find cached GrResources (e.g. GrTextures). The ID has two parts: - * the domain and the key. Domains simply allow multiple clients to use 0-based indices as their - * cache key without colliding. The key uniquely identifies a GrResource within the domain. - * Users of the cache must obtain a domain via GenerateDomain(). - */ -struct GrCacheID { -public: - typedef uint8_t Domain; - - struct Key { - union { - uint8_t fData8[16]; - uint32_t fData32[4]; - uint64_t fData64[2]; - }; - }; - - /** - * A default cache ID is invalid; a set method must be called before the object is used. - */ - GrCacheID() { fDomain = kInvalid_Domain; } - - /** - * Initialize the cache ID to a domain and key. - */ - GrCacheID(Domain domain, const Key& key) { - SkASSERT(kInvalid_Domain != domain); - this->reset(domain, key); - } - - void reset(Domain domain, const Key& key) { - fDomain = domain; - memcpy(&fKey, &key, sizeof(Key)); - } - - /** Has this been initialized to a valid domain */ - bool isValid() const { return kInvalid_Domain != fDomain; } - - const Key& getKey() const { SkASSERT(this->isValid()); return fKey; } - Domain getDomain() const { SkASSERT(this->isValid()); return fDomain; } - - /** Creates a new unique ID domain. */ - static Domain GenerateDomain(); - -private: - Key fKey; - Domain fDomain; - - static const Domain kInvalid_Domain = 0; -}; - -/** * Clips are composed from these objects. */ enum GrClipType { |