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

Unified Diff: src/gpu/GrAtlasTextContext.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/GrAddPathRenderers_default.cpp ('k') | src/gpu/GrBatchTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAtlasTextContext.cpp
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 14930fa4a3008860715dc9b5477ab3aa18c316c2..33e4f7ed86237dba488e395e25978f81e3e8e6ca 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -13,6 +13,7 @@
#include "GrDrawTarget.h"
#include "GrFontScaler.h"
#include "GrIndexBuffer.h"
+#include "GrResourceProvider.h"
#include "GrStrokeInfo.h"
#include "GrTextBlobCache.h"
#include "GrTexturePriv.h"
@@ -1514,14 +1515,16 @@ 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) {
+ if (!vertices || !indexBuffer) {
SkDebugf("Could not allocate vertices\n");
return;
}
@@ -1529,8 +1532,7 @@ public:
unsigned char* currVertex = reinterpret_cast<unsigned char*>(vertices);
// setup drawinfo
- const GrIndexBuffer* quadIndexBuffer = batchTarget->quadIndexBuffer();
- int maxInstancesPerDraw = quadIndexBuffer->maxQuads();
+ int maxInstancesPerDraw = indexBuffer->maxQuads();
GrDrawTarget::DrawInfo drawInfo;
drawInfo.setPrimitiveType(kTriangles_GrPrimitiveType);
@@ -1540,7 +1542,7 @@ public:
drawInfo.setIndicesPerInstance(kIndicesPerGlyph);
drawInfo.adjustStartVertex(firstVertex);
drawInfo.setVertexBuffer(vertexBuffer);
- drawInfo.setIndexBuffer(quadIndexBuffer);
+ drawInfo.setIndexBuffer(indexBuffer);
// We cache some values to avoid going to the glyphcache for the same fontScaler twice
// in a row
« 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