Cleanup and reorganize GrProgramDesc::Build and key layout
Move all of the processor-specific information into functions, rather
than splitting it between the calling and called code.
Stop putting the size of the key into the key. This was an attempt to
avoid collisions (I assume), but felt odd. Instead, add a few important
bits to more reliably protect against collisions, like # of vertex
attributes, # of child FPs, etc.
Important: Stop calling visitTextureEffects to put fp sampler info in
the key. That function visits the entire fp *tree*, so we were adding
sampler information in large FP trees many times. Instead, just add the
sampler information when the specific fp we're emitting is a texture
effect.
Finally, change addString to appendComment, to make it clear that it
doesn't impact the actual key at all.
Bug: skia:11372
Change-Id: Ibf10db1165b27857e5e5e712db538749b41883a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379736
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrProgramDesc.h b/src/gpu/GrProgramDesc.h
index c471f8c..2ab878d 100644
--- a/src/gpu/GrProgramDesc.h
+++ b/src/gpu/GrProgramDesc.h
@@ -64,7 +64,7 @@
}
template <typename StringFunc>
- void addString(StringFunc&& sf) {
+ void appendComment(StringFunc&& sf) {
#ifdef SK_DEBUG
fDescription.append(sf());
fDescription.append("\n");
@@ -92,10 +92,6 @@
return (fData.count() + (fBitsUsed ? 1 : 0)) * sizeof(uint32_t);
}
- size_t sizeInBits() const {
- return (fData.count() * sizeof(uint32_t) * CHAR_BIT) + fBitsUsed;
- }
-
GrProcessorKeyBuilder& operator=(const GrProcessorKeyBuilder& other) = default;
bool operator==(const GrProcessorKeyBuilder& that) const {