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/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 1057fb8..9a6b33f 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1339,7 +1339,7 @@
this->flushScissorTest(GrScissorTest::kDisabled);
this->disableWindowRectangles();
this->flushColorWrite(true);
- this->flushClearColor(SK_PMColor4fTRANSPARENT);
+ this->flushClearColor({0, 0, 0, 0});
for (int i = 0; i < mipLevelCount; ++i) {
if (levelClearMask & (1U << i)) {
this->bindSurfaceFBOForPixelOps(tex.get(), i, GR_GL_FRAMEBUFFER,
@@ -1889,8 +1889,10 @@
return bufferState->fGLTarget;
}
-void GrGLGpu::clear(const GrScissorState& scissor, const SkPMColor4f& color,
- GrRenderTarget* target, GrSurfaceOrigin origin) {
+void GrGLGpu::clear(const GrScissorState& scissor,
+ std::array<float, 4> color,
+ GrRenderTarget* target,
+ GrSurfaceOrigin origin) {
// parent class should never let us get here with no RT
SkASSERT(target);
SkASSERT(!this->caps()->performColorClearsAsDraws());
@@ -2719,8 +2721,8 @@
}
}
-void GrGLGpu::flushClearColor(const SkPMColor4f& color) {
- GrGLfloat r = color.fR, g = color.fG, b = color.fB, a = color.fA;
+void GrGLGpu::flushClearColor(std::array<float, 4> color) {
+ GrGLfloat r = color[0], g = color[1], b = color[2], a = color[3];
if (this->glCaps().clearToBoundaryValuesIsBroken() &&
(1 == r || 0 == r) && (1 == g || 0 == g) && (1 == b || 0 == b) && (1 == a || 0 == a)) {
static const GrGLfloat safeAlpha1 = nextafter(1.f, 2.f);