static const uint64_t kDefaultPublicCacheID = 0;
static const uint8_t kInvalid_ResourceType = 0;
- /**
- * All scratch resources should be Unrestricted so they can be used
- * by any domain.
- */
- static const uint8_t kUnrestricted_ResourceDomain = 0;
static uint8_t GetNextDomain();
static uint8_t GetNextResourceType();
static const uint64_t kDefault_CacheID = 0;
/**
+ * All scratch resources should be Unrestricted so they can be used
+ * by any domain.
+ */
+static const uint8_t kUnrestricted_ResourceDomain = 0;
+
+
+/**
* Describes a texture to be created.
*/
struct GrTextureDesc {
, fHeight(0)
, fConfig(kUnknown_GrPixelConfig)
, fSampleCnt(0)
- , fClientCacheID(kDefault_CacheID) {
+ , fClientCacheID(kDefault_CacheID)
+ , fResourceDomain(kUnrestricted_ResourceDomain) {
}
GrTextureFlags fFlags; //!< bitfield of TextureFlags
* is only relevant for textures that will be cached.
*/
uint64_t fClientCacheID;
+
+ /**
+ * Allows cache clients to cluster their textures inside domains (e.g.,
+ * alpha clip masks). Only relevant for cached textures.
+ */
+ uint8_t fResourceDomain;
};
/**
GrCacheID* cacheID) {
cacheID->fPublicID = GrCacheID::kDefaultPublicCacheID;
cacheID->fResourceSpecific32 = width | (height << 16);
- cacheID->fDomain = GrCacheID::kUnrestricted_ResourceDomain;
+ cacheID->fDomain = kUnrestricted_ResourceDomain;
GrAssert(sampleCnt >= 0 && sampleCnt < 256);
cacheID->fResourceSpecific16 = sampleCnt << 8;
}
cacheID->fPublicID = clientKey;
- cacheID->fDomain = GrCacheID::kUnrestricted_ResourceDomain;
+ cacheID->fDomain = desc.fResourceDomain;
// we assume we only need 16 bits of width and height
// assert that texture creation will fail anyway if this assumption