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

Unified Diff: src/gpu/GrAADistanceFieldPathRenderer.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 | « include/gpu/GrTextureProvider.h ('k') | src/gpu/GrAAHairLinePathRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAADistanceFieldPathRenderer.cpp
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index ca8c52fa348289ad62ad95f0d530c46857f55db0..669ec09d97ae02ab629204199a5f22fc38500390 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -15,7 +15,6 @@
#include "GrPipelineBuilder.h"
#include "GrSurfacePriv.h"
#include "GrSWMaskHelper.h"
-#include "GrResourceProvider.h"
#include "GrTexturePriv.h"
#include "GrVertexBuffer.h"
#include "effects/GrDistanceFieldGeoProc.h"
@@ -195,17 +194,13 @@
this->initDraw(batchTarget, dfProcessor, pipeline);
- static const int kVertsPerQuad = 4;
- static const int kIndicesPerQuad = 6;
-
- SkAutoTUnref<const GrIndexBuffer> indexBuffer(
- batchTarget->resourceProvider()->refQuadIndexBuffer());
-
// allocate vertices
size_t vertexStride = dfProcessor->getVertexStride();
SkASSERT(vertexStride == 2 * sizeof(SkPoint));
+
+ int vertexCount = GrBatchTarget::kVertsPerRect * instanceCount;
+
const GrVertexBuffer* vertexBuffer;
- int vertexCount = kVertsPerQuad * instanceCount;
int firstVertex;
void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride,
@@ -213,23 +208,24 @@
&vertexBuffer,
&firstVertex);
- if (!vertices || !indexBuffer) {
+ if (!vertices) {
SkDebugf("Could not allocate vertices\n");
return;
}
// We may have to flush while uploading path data to the atlas, so we set up the draw here
- int maxInstancesPerDraw = indexBuffer->maxQuads();
+ const GrIndexBuffer* quadIndexBuffer = batchTarget->quadIndexBuffer();
+ int maxInstancesPerDraw = quadIndexBuffer->maxQuads();
GrDrawTarget::DrawInfo drawInfo;
drawInfo.setPrimitiveType(kTriangles_GrPrimitiveType);
drawInfo.setStartVertex(0);
drawInfo.setStartIndex(0);
- drawInfo.setVerticesPerInstance(kVertsPerQuad);
- drawInfo.setIndicesPerInstance(kIndicesPerQuad);
+ drawInfo.setVerticesPerInstance(GrBatchTarget::kVertsPerRect);
+ drawInfo.setIndicesPerInstance(GrBatchTarget::kIndicesPerRect);
drawInfo.adjustStartVertex(firstVertex);
drawInfo.setVertexBuffer(vertexBuffer);
- drawInfo.setIndexBuffer(indexBuffer);
+ drawInfo.setIndexBuffer(quadIndexBuffer);
int instancesToFlush = 0;
for (int i = 0; i < instanceCount; i++) {
@@ -284,7 +280,7 @@
// Now set vertices
intptr_t offset = reinterpret_cast<intptr_t>(vertices);
- offset += i * kVertsPerQuad * vertexStride;
+ offset += i * GrBatchTarget::kVertsPerRect * vertexStride;
SkPoint* positions = reinterpret_cast<SkPoint*>(offset);
this->drawPath(batchTarget,
atlas,
« no previous file with comments | « include/gpu/GrTextureProvider.h ('k') | src/gpu/GrAAHairLinePathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698