24 struct KnownSkSLProgramInterface {
25 bool useLastFragColor;
26 bool useRTFlipUniform;
27 bool outputSecondaryColor;
35 const std::string shaders[],
45 writer.writeUInt(shaderType);
47 writer.writeByteArray(shaders[i].c_str(), shaders[i].size());
48 writer.writePad32(&interfaces[std::min(i, numInterfaces - 1)],
63 writer.writeByteArray(attr.c_str(), attr.size());
72 return writer.snapshotAsData();
77 int version = reader->
readInt();
83 std::string shaders[],
89 const char* shaderBuf =
static_cast<const char*
>(reader->
skipByteArray(&shaderLen));
91 shaders[i].assign(shaderBuf, shaderLen);
95 if (i < numInterfaces) {
96 reader->
readPad32(&interfaces[i],
sizeof(interfaces[i]));
114 const char* attrName =
static_cast<const char*
>(reader->
skipByteArray(&attrLen));
116 attr.assign(attrName, attrLen);
static const int kGrShaderTypeCount
static constexpr bool SkToBool(const T &x)
void writeInt(int32_t value) override
const void * data() const
const void * skipByteArray(size_t *size)
bool validate(bool isValid)
const void * skip(size_t size)
bool readPad32(void *buffer, size_t bytes)
void resize(size_t count)
sk_sp< SkData > PackCachedShaders(SkFourByteTag shaderType, const std::string shaders[], const SkSL::Program::Interface interfaces[], int numInterfaces, const ShaderMetadata *meta)
bool UnpackCachedShaders(SkReadBuffer *reader, std::string shaders[], SkSL::Program::Interface interfaces[], int numInterfaces, ShaderMetadata *meta)
SkFourByteTag GetType(SkReadBuffer *reader)
static constexpr int kCurrentVersion
static const int kInvalidTag
ProgramInterface Interface