Enable wide color support in CCPR
Unlike other ops, always use half-float colors. The logic around the
Instance struct makes dynamically switching color size tricky.
CCPR stores color in a per-instance attribute though, so the cost of
always using FP16 is much lower.
Bug: skia:
Change-Id: I9c0c64940f74f915a18417a5830030558e065d28
Reviewed-on: https://skia-review.googlesource.com/c/182760
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ccpr/GrCCPathProcessor.h b/src/gpu/ccpr/GrCCPathProcessor.h
index bd544bb..2f54d67 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.h
+++ b/src/gpu/ccpr/GrCCPathProcessor.h
@@ -56,15 +56,15 @@
SkRect fDevBounds45; // Bounding box in "| 1 -1 | * devCoords" space.
// | 1 1 |
SkIVector fDevToAtlasOffset; // Translation from device space to location in atlas.
- GrColor fColor;
+ uint64_t fColor; // Color always stored as 4 x fp16
void set(const SkRect& devBounds, const SkRect& devBounds45,
- const SkIVector& devToAtlasOffset, GrColor, DoEvenOddFill = DoEvenOddFill::kNo);
- void set(const GrCCPathCacheEntry&, const SkIVector& shift, GrColor,
+ const SkIVector& devToAtlasOffset, uint64_t, DoEvenOddFill = DoEvenOddFill::kNo);
+ void set(const GrCCPathCacheEntry&, const SkIVector& shift, uint64_t,
DoEvenOddFill = DoEvenOddFill::kNo);
};
- GR_STATIC_ASSERT(4 * 11 == sizeof(Instance));
+ GR_STATIC_ASSERT(4 * 12 == sizeof(Instance));
static sk_sp<const GrBuffer> FindVertexBuffer(GrOnFlushResourceProvider*);
static sk_sp<const GrBuffer> FindIndexBuffer(GrOnFlushResourceProvider*);
@@ -102,7 +102,7 @@
{"devbounds", kFloat4_GrVertexAttribType, kFloat4_GrSLType},
{"devbounds45", kFloat4_GrVertexAttribType, kFloat4_GrSLType},
{"dev_to_atlas_offset", kInt2_GrVertexAttribType, kInt2_GrSLType},
- {"color", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType}
+ {"color", kHalf4_GrVertexAttribType, kHalf4_GrSLType}
};
static constexpr Attribute kEdgeNormsAttrib = {"edge_norms", kFloat4_GrVertexAttribType,
kFloat4_GrSLType};
@@ -111,7 +111,7 @@
};
inline void GrCCPathProcessor::Instance::set(const SkRect& devBounds, const SkRect& devBounds45,
- const SkIVector& devToAtlasOffset, GrColor color,
+ const SkIVector& devToAtlasOffset, uint64_t color,
DoEvenOddFill doEvenOddFill) {
if (DoEvenOddFill::kYes == doEvenOddFill) {
// "right < left" indicates even-odd fill type.