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/GrAtlasTextContext.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/GrAtlasTextContext.cpp')
-rw-r--r-- | src/gpu/GrAtlasTextContext.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp index 33e4f7ed86..14930fa4a3 100644 --- a/src/gpu/GrAtlasTextContext.cpp +++ b/src/gpu/GrAtlasTextContext.cpp @@ -13,7 +13,6 @@ #include "GrDrawTarget.h" #include "GrFontScaler.h" #include "GrIndexBuffer.h" -#include "GrResourceProvider.h" #include "GrStrokeInfo.h" #include "GrTextBlobCache.h" #include "GrTexturePriv.h" @@ -1515,16 +1514,14 @@ public: int glyphCount = this->numGlyphs(); int instanceCount = fInstanceCount; - SkAutoTUnref<const GrIndexBuffer> indexBuffer( - batchTarget->resourceProvider()->refQuadIndexBuffer()); - const GrVertexBuffer* vertexBuffer; int firstVertex; + void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, glyphCount * kVerticesPerGlyph, &vertexBuffer, &firstVertex); - if (!vertices || !indexBuffer) { + if (!vertices) { SkDebugf("Could not allocate vertices\n"); return; } @@ -1532,7 +1529,8 @@ public: unsigned char* currVertex = reinterpret_cast<unsigned char*>(vertices); // setup drawinfo - int maxInstancesPerDraw = indexBuffer->maxQuads(); + const GrIndexBuffer* quadIndexBuffer = batchTarget->quadIndexBuffer(); + int maxInstancesPerDraw = quadIndexBuffer->maxQuads(); GrDrawTarget::DrawInfo drawInfo; drawInfo.setPrimitiveType(kTriangles_GrPrimitiveType); @@ -1542,7 +1540,7 @@ public: drawInfo.setIndicesPerInstance(kIndicesPerGlyph); drawInfo.adjustStartVertex(firstVertex); drawInfo.setVertexBuffer(vertexBuffer); - drawInfo.setIndexBuffer(indexBuffer); + drawInfo.setIndexBuffer(quadIndexBuffer); // We cache some values to avoid going to the glyphcache for the same fontScaler twice // in a row |