GPU clear values: just 4 floats
We previously represented these as SkPMColor4f. However, upcoming
changes will add limited support for clearing/drawing to unpremul
dst. Just store the clear values as four floats without assigned
interpretation.
Also, noticed a bug by code inspection: we weren't accounting for
write view swizzle in GrRTC. Fixed and added gm to test.
Bug: skia:11019
Change-Id: I1bce1f6c97a156c0377ebad1b166eb641362b67a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340098
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrOpsTask.h b/src/gpu/GrOpsTask.h
index c77e69f..39cfaa4 100644
--- a/src/gpu/GrOpsTask.h
+++ b/src/gpu/GrOpsTask.h
@@ -13,7 +13,6 @@
#include "include/core/SkStrokeRec.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrRecordingContext.h"
-#include "include/private/SkColorData.h"
#include "include/private/SkTArray.h"
#include "include/private/SkTDArray.h"
#include "src/core/SkArenaAlloc.h"
@@ -126,12 +125,7 @@
void setMustPreserveStencil() { fMustPreserveStencil = true; }
// Must only be called if native color buffer clearing is enabled.
- void setColorLoadOp(GrLoadOp op, const SkPMColor4f& color);
- // Sets the clear color to transparent black
- void setColorLoadOp(GrLoadOp op) {
- static const SkPMColor4f kDefaultClearColor = {0.f, 0.f, 0.f, 0.f};
- this->setColorLoadOp(op, kDefaultClearColor);
- }
+ void setColorLoadOp(GrLoadOp op, std::array<float, 4> color = {0, 0, 0, 0});
enum class CanDiscardPreviousOps : bool {
kYes = true,
@@ -255,7 +249,7 @@
GrAuditTrail* fAuditTrail;
GrLoadOp fColorLoadOp = GrLoadOp::kLoad;
- SkPMColor4f fLoadClearColor = SK_PMColor4fTRANSPARENT;
+ std::array<float, 4> fLoadClearColor = {0, 0, 0, 0};
StencilContent fInitialStencilContent = StencilContent::kDontCare;
bool fMustPreserveStencil = false;