8#ifndef skgpu_KeyBuilder_DEFINED
9#define skgpu_KeyBuilder_DEFINED
29 virtual void addBits(uint32_t numBits, uint32_t val, std::string_view label) {
30 SkASSERT(numBits > 0 && numBits <= 32);
31 SkASSERT(numBits == 32 || (val < (1u << numBits)));
33 fCurValue |= (val << fBitsUsed);
36 if (fBitsUsed >= 32) {
39 uint32_t excess = fBitsUsed - 32;
40 fCurValue = excess ? (val >> (numBits - excess)) : 0;
44 SkASSERT(fCurValue < (1u << fBitsUsed));
47 void addBytes(uint32_t numBytes,
const void*
data, std::string_view label) {
48 const uint8_t* bytes =
reinterpret_cast<const uint8_t*
>(
data);
49 for (; numBytes --> 0; bytes++) {
50 this->
addBits(8, *bytes, label);
58 void add32(uint32_t v, std::string_view label =
"unknown") {
76 uint32_t fCurValue = 0;
77 uint32_t fBitsUsed = 0;
84 void addBits(uint32_t numBits, uint32_t val, std::string_view label)
override {
86 fDescription.
appendf(
"%.*s: %u\n", (
int)label.size(), label.data(), val);
90 fDescription.
appendf(
"%s\n", comment);
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
void add32(uint32_t v, std::string_view label="unknown")
virtual void appendComment(const char *comment)
virtual void addBits(uint32_t numBits, uint32_t val, std::string_view label)
void addBytes(uint32_t numBytes, const void *data, std::string_view label)
void addBool(bool b, std::string_view label)
KeyBuilder(skia_private::TArray< uint32_t, true > *data)
void appendComment(const char *comment) override
StringKeyBuilder(skia_private::TArray< uint32_t, true > *data)
void addBits(uint32_t numBits, uint32_t val, std::string_view label) override
SkString description() const
std::shared_ptr< const fml::Mapping > data