Revert "Avoid non-indexed quad draws on PowerVR Rogue and 54x"
This reverts commit b149700e019a794c4b0c1ab852a12ca7a5acdf7e.
Reason for revert: This was a speculative fix that didn't pan out.
Original change's description:
> Avoid non-indexed quad draws on PowerVR Rogue and 54x
>
> Bug: chromium:1203652
> Change-Id: Id83ac81c40eda2653e97a7c8ae9326c273f0f00b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420537
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:1203652
Change-Id: I73f2415e35d92514229572f2d8823c1a632a68fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421921
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 7d48b8a..258e038 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -83,7 +83,6 @@
fRequiresManualFBBarrierAfterTessellatedStencilDraw = false;
fNativeDrawIndexedIndirectIsBroken = false;
fAvoidReorderingRenderTasks = false;
- fAlwaysDrawQuadsIndexed = false;
fPreferVRAMUseOverFlushes = true;
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index 38e2552..f51d495 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -396,9 +396,6 @@
// Should we disable GrTessellationPathRenderer due to a faulty driver?
bool disableTessellationPathRenderer() const { return fDisableTessellationPathRenderer; }
- // Always use an index buffer to draw quads
- bool alwaysDrawQuadsIndexed() const { return fAlwaysDrawQuadsIndexed; }
-
// Returns how to sample the dst values for the passed in GrRenderTargetProxy.
GrDstSampleFlags getDstSampleFlagsForProxy(const GrRenderTargetProxy*, bool drawUsesMSAA) const;
@@ -568,7 +565,6 @@
bool fRequiresManualFBBarrierAfterTessellatedStencilDraw : 1;
bool fNativeDrawIndexedIndirectIsBroken : 1;
bool fAvoidReorderingRenderTasks : 1;
- bool fAlwaysDrawQuadsIndexed : 1;
// ANGLE performance workaround
bool fPreferVRAMUseOverFlushes : 1;
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index e07a961..d4942ae 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -4192,12 +4192,6 @@
}
#endif
- if (ctxInfo.renderer() == GrGLRenderer::kPowerVRRogue ||
- ctxInfo.renderer() == GrGLRenderer::kPowerVR54x) {
- // crbug.com/1203652
- fAlwaysDrawQuadsIndexed = true;
- }
-
if (ctxInfo.driver() == GrGLDriver::kFreedreno) {
formatWorkarounds->fDisallowUnorm16Transfers = true;
}
diff --git a/src/gpu/ops/GrFillRectOp.cpp b/src/gpu/ops/GrFillRectOp.cpp
index e926401..a0e8405 100644
--- a/src/gpu/ops/GrFillRectOp.cpp
+++ b/src/gpu/ops/GrFillRectOp.cpp
@@ -183,10 +183,9 @@
int numQuads() const final { return fQuads.count(); }
#endif
- VertexSpec vertexSpec(const GrCaps& caps) const {
+ VertexSpec vertexSpec() const {
auto indexBufferOption = GrQuadPerEdgeAA::CalcIndexBufferOption(fHelper.aaType(),
- fQuads.count(),
- caps);
+ fQuads.count());
return VertexSpec(fQuads.deviceQuadType(), fColorType, fQuads.localQuadType(),
fHelper.usesLocalCoords(), GrQuadPerEdgeAA::Subset::kNo,
@@ -205,7 +204,7 @@
const GrDstProxyView& dstProxyView,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp) override {
- const VertexSpec vertexSpec = this->vertexSpec(*caps);
+ const VertexSpec vertexSpec = this->vertexSpec();
GrGeometryProcessor* gp = GrQuadPerEdgeAA::MakeProcessor(arena, vertexSpec);
SkASSERT(gp->vertexStride() == vertexSpec.vertexSize());
@@ -232,7 +231,7 @@
SkArenaAlloc* arena = rContext->priv().recordTimeAllocator();
- const VertexSpec vertexSpec = this->vertexSpec(*rContext->priv().caps());
+ const VertexSpec vertexSpec = this->vertexSpec();
const int totalNumVertices = fQuads.count() * vertexSpec.verticesPerQuad();
const size_t totalVertexSizeInBytes = vertexSpec.vertexSize() * totalNumVertices;
@@ -260,7 +259,7 @@
void onPrepareDraws(GrMeshDrawTarget* target) override {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
- const VertexSpec vertexSpec = this->vertexSpec(target->caps());
+ const VertexSpec vertexSpec = this->vertexSpec();
// Make sure that if the op thought it was a solid color, the vertex spec does not use
// local coords.
@@ -298,7 +297,7 @@
return;
}
- const VertexSpec vertexSpec = this->vertexSpec(flushState->caps());
+ const VertexSpec vertexSpec = this->vertexSpec();
if (vertexSpec.needsIndexBuffer() && !fIndexBuffer) {
return;
@@ -377,15 +376,13 @@
}
#endif
- bool canAddQuads(int numQuads, GrAAType aaType, const GrCaps& caps) {
+ bool canAddQuads(int numQuads, GrAAType aaType) {
// The new quad's aa type should be the same as the first quad's or none, except when the
// first quad's aa type was already downgraded to none, in which case the stored type must
// be lifted to back to the requested type.
int quadCount = fQuads.count() + numQuads;
if (aaType != fHelper.aaType() && aaType != GrAAType::kNone) {
- auto indexBufferOption = GrQuadPerEdgeAA::CalcIndexBufferOption(aaType,
- quadCount,
- caps);
+ auto indexBufferOption = GrQuadPerEdgeAA::CalcIndexBufferOption(aaType, quadCount);
if (quadCount > GrQuadPerEdgeAA::QuadLimit(indexBufferOption)) {
// Promoting to the new aaType would've caused an overflow of the indexBuffer
// limit
@@ -397,8 +394,7 @@
fHelper.setAAType(aaType);
} else {
auto indexBufferOption = GrQuadPerEdgeAA::CalcIndexBufferOption(fHelper.aaType(),
- quadCount,
- caps);
+ quadCount);
if (quadCount > GrQuadPerEdgeAA::QuadLimit(indexBufferOption)) {
return false; // This op can't grow any more
}
@@ -409,7 +405,7 @@
// Similar to onCombineIfPossible, but adds a quad assuming its op would have been compatible.
// But since it's avoiding the op list management, it must update the op's bounds.
- bool addQuad(DrawQuad* quad, const SkPMColor4f& color, GrAAType aaType, const GrCaps& caps) {
+ bool addQuad(DrawQuad* quad, const SkPMColor4f& color, GrAAType aaType) {
SkRect newBounds = this->bounds();
newBounds.joinPossiblyEmptyRect(quad->fDevice.bounds());
@@ -419,7 +415,7 @@
if (count == 0 ) {
// Just skip the append (trivial success)
return true;
- } else if (!this->canAddQuads(count, aaType, caps)) {
+ } else if (!this->canAddQuads(count, aaType)) {
// Not enough room in the index buffer for the AA type
return false;
} else {
@@ -508,7 +504,7 @@
GrQuadUtils::ResolveAAType(aaType, quads[i].fAAFlags, quad.fDevice,
&resolvedAA, &quad.fEdgeFlags);
- if (!fillRects->addQuad(&quad, quads[i].fColor, resolvedAA, *context->priv().caps())) {
+ if (!fillRects->addQuad(&quad, quads[i].fColor, resolvedAA)) {
break;
}
diff --git a/src/gpu/ops/GrQuadPerEdgeAA.cpp b/src/gpu/ops/GrQuadPerEdgeAA.cpp
index 4ce8103..307eb0a 100644
--- a/src/gpu/ops/GrQuadPerEdgeAA.cpp
+++ b/src/gpu/ops/GrQuadPerEdgeAA.cpp
@@ -244,10 +244,10 @@
namespace GrQuadPerEdgeAA {
-IndexBufferOption CalcIndexBufferOption(GrAAType aa, int numQuads, const GrCaps& caps) {
+IndexBufferOption CalcIndexBufferOption(GrAAType aa, int numQuads) {
if (aa == GrAAType::kCoverage) {
return IndexBufferOption::kPictureFramed;
- } else if (numQuads > 1 || caps.alwaysDrawQuadsIndexed()) {
+ } else if (numQuads > 1) {
return IndexBufferOption::kIndexedRects;
} else {
return IndexBufferOption::kTriStrips;
diff --git a/src/gpu/ops/GrQuadPerEdgeAA.h b/src/gpu/ops/GrQuadPerEdgeAA.h
index 546667f..ffcaf8c 100644
--- a/src/gpu/ops/GrQuadPerEdgeAA.h
+++ b/src/gpu/ops/GrQuadPerEdgeAA.h
@@ -41,7 +41,7 @@
};
static const int kIndexBufferOptionCount = static_cast<int>(IndexBufferOption::kLast) + 1;
- IndexBufferOption CalcIndexBufferOption(GrAAType aa, int numQuads, const GrCaps&);
+ IndexBufferOption CalcIndexBufferOption(GrAAType aa, int numQuads);
// Gets the minimum ColorType that can represent a color.
ColorType MinColorType(SkPMColor4f);
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 233add0..c1c8a46 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -693,7 +693,7 @@
SkArenaAlloc* arena = context->priv().recordTimeAllocator();
fDesc = arena->make<Desc>();
- this->characterize(fDesc, *context->priv().caps());
+ this->characterize(fDesc);
fDesc->allocatePrePreparedVertices(arena);
FillInVertices(*context->priv().caps(), this, fDesc, fDesc->fPrePreparedVertices);
@@ -788,7 +788,7 @@
int numQuads() const final { return this->totNumQuads(); }
#endif
- void characterize(Desc* desc, const GrCaps& caps) const {
+ void characterize(Desc* desc) const {
SkDEBUGCODE(this->validate();)
GrQuad::Type quadType = GrQuad::Type::kAxisAligned;
@@ -829,8 +829,7 @@
SkASSERT(!CombinedQuadCountWillOverflow(overallAAType, false, desc->fNumTotalQuads));
auto indexBufferOption = GrQuadPerEdgeAA::CalcIndexBufferOption(overallAAType,
- maxQuadsPerMesh,
- caps);
+ maxQuadsPerMesh);
desc->fVertexSpec = VertexSpec(quadType, colorType, srcQuadType, /* hasLocal */ true,
subset, overallAAType, /* alpha as coverage */ true,
@@ -876,7 +875,7 @@
if (!fDesc) {
SkArenaAlloc* arena = target->allocator();
fDesc = arena->make<Desc>();
- this->characterize(fDesc, target->caps());
+ this->characterize(fDesc);
SkASSERT(!fDesc->fPrePreparedVertices);
}
diff --git a/tests/GrThreadSafeCacheTest.cpp b/tests/GrThreadSafeCacheTest.cpp
index 04e0fd1..0c36732 100644
--- a/tests/GrThreadSafeCacheTest.cpp
+++ b/tests/GrThreadSafeCacheTest.cpp
@@ -1164,6 +1164,13 @@
static void test_10(GrDirectContext* dContext, skiatest::Reporter* reporter,
TestHelper::addAccessFP addAccess,
TestHelper::checkFP check) {
+
+ if (GrBackendApi::kOpenGL != dContext->backend()) {
+ // The lower-level backends have too much going on for the following simple purging
+ // test to work
+ return;
+ }
+
TestHelper helper(dContext);
(helper.*addAccess)(helper.liveCanvas(), kImageWH, kNoID, false, false);
@@ -1217,25 +1224,8 @@
/*hits*/ 2, /*misses*/ 2, /*refs*/ 0, kNoID));
}
-DEF_GPUTEST(GrThreadSafeCache10View, reporter, origOptions) {
- // Workarounds can affect the correctness of this test by causing extra allocations.
- GrContextOptions options = origOptions;
- options.fDisableDriverCorrectnessWorkarounds = true;
- for (int ct = 0; ct < sk_gpu_test::GrContextFactory::kContextTypeCnt; ++ct) {
- auto type = static_cast<sk_gpu_test::GrContextFactory::ContextType>(ct);
- if (sk_gpu_test::GrContextFactory::ContextTypeBackend(type) != GrBackendApi::kOpenGL) {
- // The lower-level backends have too much going on for the following simple purging
- // test to work. This will likely stop working on GL if we do a better job of tracking
- // actual purgeability WRT GPU work completion.
- continue;
- }
- sk_gpu_test::GrContextFactory factory(options);
- GrDirectContext* dContext = factory.get(type);
- if (!dContext) {
- continue;
- }
- test_10(dContext, reporter, &TestHelper::addViewAccess, &TestHelper::checkView);
- }
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrThreadSafeCache10View, reporter, ctxInfo) {
+ test_10(ctxInfo.directContext(), reporter, &TestHelper::addViewAccess, &TestHelper::checkView);
}
// To enable test_10 with verts would require a bit more work, namely: