From 8b1bff29675afd25843439eade634a57f68fe16f Mon Sep 17 00:00:00 2001 From: cdalton Date: Fri, 25 Mar 2016 01:54:54 -0700 Subject: Consolidate GPU buffer implementations Consolidates all the different buffer implementations into a single GrBuffer class. This will allow us to add new buffer types, use DSA in OpenGL, track buffer bindings by unique ID, cache buffers without respect to the type of data they have been used for previously, etc. This change is strictly a refactor; it introduces no change in functionality. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1825393002 Review URL: https://codereview.chromium.org/1825393002 --- src/gpu/batches/GrAtlasTextBatch.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gpu/batches/GrAtlasTextBatch.cpp') diff --git a/src/gpu/batches/GrAtlasTextBatch.cpp b/src/gpu/batches/GrAtlasTextBatch.cpp index 8b89039406..654643d339 100644 --- a/src/gpu/batches/GrAtlasTextBatch.cpp +++ b/src/gpu/batches/GrAtlasTextBatch.cpp @@ -119,7 +119,7 @@ void GrAtlasTextBatch::onPrepareDraws(Target* target) const { target->initDraw(gp); int glyphCount = this->numGlyphs(); - const GrVertexBuffer* vertexBuffer; + const GrBuffer* vertexBuffer; void* vertices = target->makeVertexSpace(vertexStride, glyphCount * kVerticesPerGlyph, @@ -181,7 +181,8 @@ void GrAtlasTextBatch::onPrepareDraws(Target* target) const { void GrAtlasTextBatch::flush(GrVertexBatch::Target* target, FlushInfo* flushInfo) const { GrMesh mesh; - int maxGlyphsPerDraw = flushInfo->fIndexBuffer->maxQuads(); + int maxGlyphsPerDraw = + static_cast(flushInfo->fIndexBuffer->gpuMemorySize() / sizeof(uint16_t) / 6); mesh.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuffer, flushInfo->fIndexBuffer, flushInfo->fVertexOffset, kVerticesPerGlyph, kIndicesPerGlyph, flushInfo->fGlyphsToFlush, -- cgit v1.2.3