Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: src/gpu/effects/GrDashingEffect.cpp

Issue 1116943004: Move instanced index buffer creation to flush time (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix missing assignment of keys to index buffers Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrDashingEffect.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrDashingEffect.cpp
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 3f0df6737796a42a0ccbba098e23855843908d50..fa8b3a2dcf941bfc6c29b2fa27e39f6bcb1c49f8 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -19,6 +19,7 @@
#include "GrDrawTargetCaps.h"
#include "GrInvariantOutput.h"
#include "GrProcessor.h"
+#include "GrResourceProvider.h"
#include "GrStrokeInfo.h"
#include "GrVertexBuffer.h"
#include "SkGr.h"
@@ -535,16 +536,17 @@ 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 || !batchTarget->quadIndexBuffer()) {
+ if (!vertices || !indexBuffer) {
SkDebugf("Could not allocate buffers\n");
return;
}
@@ -607,8 +609,6 @@ 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(dashIndexBuffer);
+ drawInfo.setIndexBuffer(indexBuffer);
- int maxInstancesPerDraw = dashIndexBuffer->maxQuads();
+ int maxInstancesPerDraw = indexBuffer->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(GrGpu* gpu, GrDrawTarget* target,
+bool GrDashingEffect::DrawDashLine(GrDrawTarget* target,
GrPipelineBuilder* pipelineBuilder, GrColor color,
const SkMatrix& viewMatrix, const SkPoint pts[2],
bool useAA, const GrStrokeInfo& strokeInfo) {
« no previous file with comments | « src/gpu/effects/GrDashingEffect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698