Revert "Avoid non-indexed quad draws on PowerVR Rogue and 54x"

This reverts commit b149700e01.

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>
This commit is contained in:
Brian Salomon 2021-06-28 09:20:44 -04:00 committed by Skia Commit-Bot
parent 8fd0ccfc9f
commit b8c4add799
8 changed files with 28 additions and 54 deletions

View File

@ -83,7 +83,6 @@ GrCaps::GrCaps(const GrContextOptions& options) {
fRequiresManualFBBarrierAfterTessellatedStencilDraw = false;
fNativeDrawIndexedIndirectIsBroken = false;
fAvoidReorderingRenderTasks = false;
fAlwaysDrawQuadsIndexed = false;
fPreferVRAMUseOverFlushes = true;

View File

@ -396,9 +396,6 @@ public:
// 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 @@ protected:
bool fRequiresManualFBBarrierAfterTessellatedStencilDraw : 1;
bool fNativeDrawIndexedIndirectIsBroken : 1;
bool fAvoidReorderingRenderTasks : 1;
bool fAlwaysDrawQuadsIndexed : 1;
// ANGLE performance workaround
bool fPreferVRAMUseOverFlushes : 1;

View File

@ -4192,12 +4192,6 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
}
#endif
if (ctxInfo.renderer() == GrGLRenderer::kPowerVRRogue ||
ctxInfo.renderer() == GrGLRenderer::kPowerVR54x) {
// crbug.com/1203652
fAlwaysDrawQuadsIndexed = true;
}
if (ctxInfo.driver() == GrGLDriver::kFreedreno) {
formatWorkarounds->fDisallowUnorm16Transfers = true;
}

View File

@ -183,10 +183,9 @@ private:
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 @@ private:
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 @@ private:
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 @@ private:
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 @@ private:
return;
}
const VertexSpec vertexSpec = this->vertexSpec(flushState->caps());
const VertexSpec vertexSpec = this->vertexSpec();
if (vertexSpec.needsIndexBuffer() && !fIndexBuffer) {
return;
@ -377,15 +376,13 @@ private:
}
#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 @@ private:
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 @@ private:
// 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 @@ private:
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 @@ GrOp::Owner GrFillRectOp::MakeOp(GrRecordingContext* context,
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;
}

View File

@ -244,10 +244,10 @@ static void write_2d_cov_uv_strict(GrVertexWriter* vb, const GrQuadPerEdgeAA::Ve
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;

View File

@ -41,7 +41,7 @@ namespace GrQuadPerEdgeAA {
};
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);

View File

@ -693,7 +693,7 @@ private:
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 @@ private:
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 @@ private:
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 @@ private:
if (!fDesc) {
SkArenaAlloc* arena = target->allocator();
fDesc = arena->make<Desc>();
this->characterize(fDesc, target->caps());
this->characterize(fDesc);
SkASSERT(!fDesc->fPrePreparedVertices);
}

View File

@ -1164,6 +1164,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrThreadSafeCache9Verts, reporter, ctxInfo) {
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 @@ static void test_10(GrDirectContext* dContext, skiatest::Reporter* reporter,
/*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: