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

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

Issue 1126613003: Revert of Move instanced index buffer creation to flush time (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 fa8b3a2dcf941bfc6c29b2fa27e39f6bcb1c49f8..3f0df6737796a42a0ccbba098e23855843908d50 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 @@
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 @@
rectIndex++;
}
+ const GrIndexBuffer* dashIndexBuffer = batchTarget->quadIndexBuffer();
+
GrDrawTarget::DrawInfo drawInfo;
drawInfo.setPrimitiveType(kTriangles_GrPrimitiveType);
drawInfo.setStartVertex(0);
@@ -617,9 +617,9 @@
drawInfo.setIndicesPerInstance(kIndicesPerDash);
drawInfo.adjustStartVertex(firstVertex);
drawInfo.setVertexBuffer(vertexBuffer);
- drawInfo.setIndexBuffer(indexBuffer);
-
- int maxInstancesPerDraw = indexBuffer->maxQuads();
+ drawInfo.setIndexBuffer(dashIndexBuffer);
+
+ int maxInstancesPerDraw = dashIndexBuffer->maxQuads();
while (totalRectCount) {
drawInfo.setInstanceCount(SkTMin(totalRectCount, maxInstancesPerDraw));
drawInfo.setVertexCount(drawInfo.instanceCount() * drawInfo.verticesPerInstance());
@@ -761,7 +761,7 @@
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) {
« 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