From d8ed1b64a6c85a8364c23e825164b7bebb43a3a0 Mon Sep 17 00:00:00 2001 From: bsalomon Date: Mon, 4 May 2015 10:09:23 -0700 Subject: Revert of Move instanced index buffer creation to flush time (patchset #6 id:100001 of https://codereview.chromium.org/1116943004/) Reason for revert: messed up caching, recreating index buffers all the time. Original issue's description: > Move instanced index buffer creation to flush time > > Committed: https://skia.googlesource.com/skia/+/ab622c7b8cc8c39f0a594e4392b9e31b7e1ddb26 TBR=joshualitt@google.com,robertphillips@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1126613003 --- src/gpu/effects/GrDashingEffect.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/gpu/effects/GrDashingEffect.cpp') diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index fa8b3a2dcf..3f0df67377 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -19,7 +19,6 @@ #include "GrDrawTargetCaps.h" #include "GrInvariantOutput.h" #include "GrProcessor.h" -#include "GrResourceProvider.h" #include "GrStrokeInfo.h" #include "GrVertexBuffer.h" #include "SkGr.h" @@ -536,17 +535,16 @@ public: draw.fHasEndRect = hasEndRect; } - SkAutoTUnref indexBuffer( - batchTarget->resourceProvider()->refQuadIndexBuffer()); - const GrVertexBuffer* vertexBuffer; int firstVertex; + size_t vertexStride = gp->getVertexStride(); void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, totalRectCount * kVertsPerDash, &vertexBuffer, &firstVertex); - if (!vertices || !indexBuffer) { + + if (!vertices || !batchTarget->quadIndexBuffer()) { SkDebugf("Could not allocate buffers\n"); return; } @@ -609,6 +607,8 @@ public: rectIndex++; } + const GrIndexBuffer* dashIndexBuffer = batchTarget->quadIndexBuffer(); + GrDrawTarget::DrawInfo drawInfo; drawInfo.setPrimitiveType(kTriangles_GrPrimitiveType); drawInfo.setStartVertex(0); @@ -617,9 +617,9 @@ public: drawInfo.setIndicesPerInstance(kIndicesPerDash); drawInfo.adjustStartVertex(firstVertex); drawInfo.setVertexBuffer(vertexBuffer); - drawInfo.setIndexBuffer(indexBuffer); + drawInfo.setIndexBuffer(dashIndexBuffer); - int maxInstancesPerDraw = indexBuffer->maxQuads(); + int maxInstancesPerDraw = dashIndexBuffer->maxQuads(); while (totalRectCount) { drawInfo.setInstanceCount(SkTMin(totalRectCount, maxInstancesPerDraw)); drawInfo.setVertexCount(drawInfo.instanceCount() * drawInfo.verticesPerInstance()); @@ -761,7 +761,7 @@ static GrBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const Sk return DashBatch::Create(geometry, cap, aaMode, fullDash); } -bool GrDashingEffect::DrawDashLine(GrDrawTarget* target, +bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target, GrPipelineBuilder* pipelineBuilder, GrColor color, const SkMatrix& viewMatrix, const SkPoint pts[2], bool useAA, const GrStrokeInfo& strokeInfo) { -- cgit v1.2.3