diff options
author | 2015-05-04 10:09:23 -0700 | |
---|---|---|
committer | 2015-05-04 10:09:24 -0700 | |
commit | d8ed1b64a6c85a8364c23e825164b7bebb43a3a0 (patch) | |
tree | 6b3c337b619318bee15747c3a6e38bf75fa9d8dc /src/gpu/effects/GrDashingEffect.cpp | |
parent | 973d1f1f60f2710a268a3165aa4f3460502d4be5 (diff) |
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
Diffstat (limited to 'src/gpu/effects/GrDashingEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrDashingEffect.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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<const GrIndexBuffer> 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) { |