8#ifndef skgpu_ResourceKey_DEFINED
9#define skgpu_ResourceKey_DEFINED
39 return fKey[kHash_MetaDataIdx];
45 return this->internalSize();
50 fKey.
reset(kMetaDataCnt);
51 fKey[kHash_MetaDataIdx] = 0;
63 if (
nullptr == fKey) {
66 uint32_t*
hash = &fKey->fKey[kHash_MetaDataIdx];
74 SkDEBUGCODE(
size_t dataCount = fKey->internalSize() /
sizeof(uint32_t) - kMetaDataCnt;)
76 return fKey->fKey[(
int)kMetaDataCnt + dataIdx];
83 key->fKey.reset(kMetaDataCnt +
count);
84 size_t size = (
count + kMetaDataCnt) *
sizeof(uint32_t);
102 return 0 == memcmp(fKey.
get(), that.fKey.
get(), kMetaDataCnt*
sizeof(uint32_t)) &&
103 0 == memcmp(&fKey[kMetaDataCnt], &that.fKey[kMetaDataCnt], this->dataSize());
111 size_t bytes = that.
size();
113 fKey.
reset(bytes /
sizeof(uint32_t));
114 memcpy(fKey.
get(), that.fKey.
get(), bytes);
121 uint32_t
domain()
const {
return fKey[kDomainAndSize_MetaDataIdx] & 0xffff; }
129 return &fKey[kMetaDataCnt];
139 SkDebugf(
"size: %zuB ", this->internalSize());
140 size_t dataCount = this->internalSize() /
sizeof(uint32_t) - kMetaDataCnt;
141 for (
size_t i = 0;
i < dataCount; ++
i) {
142 SkDebugf(
"%u ", fKey[SkTo<int>(kMetaDataCnt+
i)]);
153 kDomainAndSize_MetaDataIdx,
155 kLastMetaDataIdx = kDomainAndSize_MetaDataIdx
157 static const uint32_t kMetaDataCnt = kLastMetaDataIdx + 1;
159 size_t internalSize()
const {
return fKey[kDomainAndSize_MetaDataIdx] >> 16; }
161 void validate()
const {
165 this->internalSize() -
sizeof(uint32_t)));
169 friend class ::TestResource;
266 const char*
tag()
const {
return fTag; }
274 void dump(
const char* label)
const {
275 SkDebugf(
"%s tag: %s\n", label, fTag ? fTag :
"None");
289 const char*
tag =
nullptr)
292 Data32CntForInnerKey(innerKey) + extraData32Cnt) {
295 uint32_t* innerKeyData = &this->
operator[](extraData32Cnt);
296 const uint32_t* srcData = innerKey.
data();
297 (*innerKeyData++) = innerKey.
domain();
298 memcpy(innerKeyData, srcData, innerKey.
dataSize());
303 static int Data32CntForInnerKey(
const UniqueKey& innerKey) {
321#define SKGPU_DECLARE_STATIC_UNIQUE_KEY(name) static SkOnce name##_once
324#define SKGPU_DEFINE_STATIC_UNIQUE_KEY(name) \
325 static SkAlignedSTStorage<1, skgpu::UniqueKey> name##_storage; \
326 name##_once(skgpu::skgpu_init_static_unique_key_once, &name##_storage); \
327 static const skgpu::UniqueKey& name = \
328 *reinterpret_cast<skgpu::UniqueKey*>(name##_storage.get())
340 uint32_t contextUniqueID,
357 bool fInThreadSafeCache =
false;
361 uint32_t msgBusUniqueID) {
362 return msg.
contextID() == msgBusUniqueID;
386 uint32_t msgBusUniqueID) {
static constexpr bool SkIsAlign4(T x)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
sk_sp< T > sk_ref_sp(T *obj)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
constexpr size_t SkToSizeT(S x)
constexpr uint16_t SkToU16(S x)
constexpr int SkToInt(S x)
constexpr uint32_t SkToU32(S x)
static constexpr uint32_t SK_InvalidUniqueID
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
uint32_t & operator[](int dataIdx)
Builder(ResourceKey *key, uint32_t domain, int data32Count)
static const uint32_t kInvalidDomain
const uint32_t * data() const
ResourceKey & operator=(const ResourceKey &that)
bool operator==(const ResourceKey &that) const
Builder(ScratchKey *key, ResourceType type, int data32Count)
static ResourceType GenerateResourceType()
ResourceType resourceType() const
bool operator==(const ScratchKey &that) const
ScratchKey(const ScratchKey &that)
bool operator!=(const ScratchKey &that) const
ScratchKey & operator=(const ScratchKey &that)
bool inThreadSafeCache() const
const UniqueKey & key() const
UniqueKeyInvalidatedMessage()=default
UniqueKeyInvalidatedMessage & operator=(const UniqueKeyInvalidatedMessage &)=default
UniqueKeyInvalidatedMessage(const UniqueKeyInvalidatedMessage &)=default
UniqueKeyInvalidatedMessage(const UniqueKey &key, uint32_t contextUniqueID, bool inThreadSafeCache=false)
uint32_t contextID() const
UniqueKeyInvalidatedMsg_Graphite(const UniqueKey &key, uint32_t recorderID)
const UniqueKey & key() const
uint32_t recorderID() const
UniqueKeyInvalidatedMsg_Graphite & operator=(const UniqueKeyInvalidatedMsg_Graphite &)=default
UniqueKeyInvalidatedMsg_Graphite()=default
UniqueKeyInvalidatedMsg_Graphite(const UniqueKeyInvalidatedMsg_Graphite &)=default
Builder(UniqueKey *key, Domain type, int data32Count, const char *tag=nullptr)
Builder(UniqueKey *key, const UniqueKey &innerKey, Domain domain, int extraData32Cnt, const char *tag=nullptr)
static Domain GenerateDomain()
UniqueKey & operator=(const UniqueKey &that)
sk_sp< SkData > refCustomData() const
const uint32_t * data() const
SkData * getCustomData() const
void setCustomData(sk_sp< SkData > data)
UniqueKey(const UniqueKey &that)
bool operator!=(const UniqueKey &that) const
bool operator==(const UniqueKey &that) const
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static bool SkShouldPostMessageToBus(const UniqueKeyInvalidatedMessage &msg, uint32_t msgBusUniqueID)
static void skgpu_init_static_unique_key_once(SkAlignedSTStorage< 1, UniqueKey > *keyStorage)
uint32_t ResourceKeyHash(const uint32_t *data, size_t size)
std::shared_ptr< const fml::Mapping > data