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

Side by Side Diff: src/gpu/GrAtlasTextContext.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, 7 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrAddPathRenderers_default.cpp ('k') | src/gpu/GrBatchTarget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "GrAtlasTextContext.h" 7 #include "GrAtlasTextContext.h"
8 8
9 #include "GrBatch.h" 9 #include "GrBatch.h"
10 #include "GrBatchFontCache.h" 10 #include "GrBatchFontCache.h"
11 #include "GrBatchTarget.h" 11 #include "GrBatchTarget.h"
12 #include "GrDefaultGeoProcFactory.h" 12 #include "GrDefaultGeoProcFactory.h"
13 #include "GrDrawTarget.h" 13 #include "GrDrawTarget.h"
14 #include "GrFontScaler.h" 14 #include "GrFontScaler.h"
15 #include "GrIndexBuffer.h" 15 #include "GrIndexBuffer.h"
16 #include "GrResourceProvider.h"
17 #include "GrStrokeInfo.h" 16 #include "GrStrokeInfo.h"
18 #include "GrTextBlobCache.h" 17 #include "GrTextBlobCache.h"
19 #include "GrTexturePriv.h" 18 #include "GrTexturePriv.h"
20 #include "GrVertexBuffer.h" 19 #include "GrVertexBuffer.h"
21 20
22 #include "SkAutoKern.h" 21 #include "SkAutoKern.h"
23 #include "SkColorPriv.h" 22 #include "SkColorPriv.h"
24 #include "SkColorFilter.h" 23 #include "SkColorFilter.h"
25 #include "SkDistanceFieldGen.h" 24 #include "SkDistanceFieldGen.h"
26 #include "SkDraw.h" 25 #include "SkDraw.h"
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 1507
1509 size_t vertexStride = gp->getVertexStride(); 1508 size_t vertexStride = gp->getVertexStride();
1510 SkASSERT(vertexStride == (fUseDistanceFields ? 1509 SkASSERT(vertexStride == (fUseDistanceFields ?
1511 get_vertex_stride_df(fMaskFormat, fUseLCDText) : 1510 get_vertex_stride_df(fMaskFormat, fUseLCDText) :
1512 get_vertex_stride(fMaskFormat))); 1511 get_vertex_stride(fMaskFormat)));
1513 1512
1514 this->initDraw(batchTarget, gp, pipeline); 1513 this->initDraw(batchTarget, gp, pipeline);
1515 1514
1516 int glyphCount = this->numGlyphs(); 1515 int glyphCount = this->numGlyphs();
1517 int instanceCount = fInstanceCount; 1516 int instanceCount = fInstanceCount;
1518 SkAutoTUnref<const GrIndexBuffer> indexBuffer(
1519 batchTarget->resourceProvider()->refQuadIndexBuffer());
1520
1521 const GrVertexBuffer* vertexBuffer; 1517 const GrVertexBuffer* vertexBuffer;
1522 int firstVertex; 1518 int firstVertex;
1519
1523 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, 1520 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride,
1524 glyphCount * kVert icesPerGlyph, 1521 glyphCount * kVert icesPerGlyph,
1525 &vertexBuffer, 1522 &vertexBuffer,
1526 &firstVertex); 1523 &firstVertex);
1527 if (!vertices || !indexBuffer) { 1524 if (!vertices) {
1528 SkDebugf("Could not allocate vertices\n"); 1525 SkDebugf("Could not allocate vertices\n");
1529 return; 1526 return;
1530 } 1527 }
1531 1528
1532 unsigned char* currVertex = reinterpret_cast<unsigned char*>(vertices); 1529 unsigned char* currVertex = reinterpret_cast<unsigned char*>(vertices);
1533 1530
1534 // setup drawinfo 1531 // setup drawinfo
1535 int maxInstancesPerDraw = indexBuffer->maxQuads(); 1532 const GrIndexBuffer* quadIndexBuffer = batchTarget->quadIndexBuffer();
1533 int maxInstancesPerDraw = quadIndexBuffer->maxQuads();
1536 1534
1537 GrDrawTarget::DrawInfo drawInfo; 1535 GrDrawTarget::DrawInfo drawInfo;
1538 drawInfo.setPrimitiveType(kTriangles_GrPrimitiveType); 1536 drawInfo.setPrimitiveType(kTriangles_GrPrimitiveType);
1539 drawInfo.setStartVertex(0); 1537 drawInfo.setStartVertex(0);
1540 drawInfo.setStartIndex(0); 1538 drawInfo.setStartIndex(0);
1541 drawInfo.setVerticesPerInstance(kVerticesPerGlyph); 1539 drawInfo.setVerticesPerInstance(kVerticesPerGlyph);
1542 drawInfo.setIndicesPerInstance(kIndicesPerGlyph); 1540 drawInfo.setIndicesPerInstance(kIndicesPerGlyph);
1543 drawInfo.adjustStartVertex(firstVertex); 1541 drawInfo.adjustStartVertex(firstVertex);
1544 drawInfo.setVertexBuffer(vertexBuffer); 1542 drawInfo.setVertexBuffer(vertexBuffer);
1545 drawInfo.setIndexBuffer(indexBuffer); 1543 drawInfo.setIndexBuffer(quadIndexBuffer);
1546 1544
1547 // We cache some values to avoid going to the glyphcache for the same fo ntScaler twice 1545 // We cache some values to avoid going to the glyphcache for the same fo ntScaler twice
1548 // in a row 1546 // in a row
1549 const SkDescriptor* desc = NULL; 1547 const SkDescriptor* desc = NULL;
1550 SkGlyphCache* cache = NULL; 1548 SkGlyphCache* cache = NULL;
1551 GrFontScaler* scaler = NULL; 1549 GrFontScaler* scaler = NULL;
1552 SkTypeface* typeface = NULL; 1550 SkTypeface* typeface = NULL;
1553 1551
1554 int instancesToFlush = 0; 1552 int instancesToFlush = 0;
1555 for (int i = 0; i < instanceCount; i++) { 1553 for (int i = 0; i < instanceCount; i++) {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 pipelineBuilder.setFromPaint(grPaint, rt, clip); 2159 pipelineBuilder.setFromPaint(grPaint, rt, clip);
2162 2160
2163 GrColor color = grPaint.getColor(); 2161 GrColor color = grPaint.getColor();
2164 for (int run = 0; run < cacheBlob->fRunCount; run++) { 2162 for (int run = 0; run < cacheBlob->fRunCount; run++) {
2165 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk Paint); 2163 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk Paint);
2166 } 2164 }
2167 2165
2168 // Now flush big glyphs 2166 // Now flush big glyphs
2169 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); 2167 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0);
2170 } 2168 }
OLDNEW
« no previous file with comments | « src/gpu/GrAddPathRenderers_default.cpp ('k') | src/gpu/GrBatchTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698