diff options
author | 2015-08-13 14:55:50 -0700 | |
---|---|---|
committer | 2015-08-13 14:55:50 -0700 | |
commit | 16b991390bb988b194a868ab8de66db4c21c7c13 (patch) | |
tree | 113ed198661b9ee00e0cb47a7edeaadc63f2323f /src/gpu/batches/GrBatch.cpp | |
parent | 8f4fe37b1cb7c98577d76e7004f35929664e251e (diff) |
Split GrDrawBatch and GrVertexBatch into their own files
TBR=joshualitt@google.com
Review URL: https://codereview.chromium.org/1296483002
Diffstat (limited to 'src/gpu/batches/GrBatch.cpp')
-rw-r--r-- | src/gpu/batches/GrBatch.cpp | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/gpu/batches/GrBatch.cpp b/src/gpu/batches/GrBatch.cpp index b696d6b95b..a3a9884b0f 100644 --- a/src/gpu/batches/GrBatch.cpp +++ b/src/gpu/batches/GrBatch.cpp @@ -6,8 +6,6 @@ */ #include "GrBatch.h" -#include "GrBatchTarget.h" -#include "GrResourceProvider.h" #include "GrMemoryPool.h" #include "SkSpinlock.h" @@ -58,67 +56,3 @@ GrBatch::GrBatch() } GrBatch::~GrBatch() {} - -////////////////////////////////////////////////////////////////////////////// - -GrDrawBatch::GrDrawBatch() : fPipelineInstalled(false) { } - -GrDrawBatch::~GrDrawBatch() { - if (fPipelineInstalled) { - this->pipeline()->~GrPipeline(); - } -} - -bool GrDrawBatch::installPipeline(const GrPipeline::CreateArgs& args) { - GrPipelineOptimizations opts; - void* location = fPipelineStorage.get(); - if (!GrPipeline::CreateAt(location, args, &opts)) { - return false; - } - this->initBatchTracker(opts); - fPipelineInstalled = true; - return true; -} - -////////////////////////////////////////////////////////////////////////////// - -GrVertexBatch::GrVertexBatch() : fNumberOfDraws(0) {} - -void* GrVertexBatch::InstancedHelper::init(GrBatchTarget* batchTarget, GrPrimitiveType primType, - size_t vertexStride, const GrIndexBuffer* indexBuffer, - int verticesPerInstance, int indicesPerInstance, - int instancesToDraw) { - SkASSERT(batchTarget); - if (!indexBuffer) { - return NULL; - } - const GrVertexBuffer* vertexBuffer; - int firstVertex; - int vertexCount = verticesPerInstance * instancesToDraw; - void* vertices = batchTarget->makeVertSpace(vertexStride, vertexCount, - &vertexBuffer, &firstVertex); - if (!vertices) { - SkDebugf("Vertices could not be allocated for instanced rendering."); - return NULL; - } - SkASSERT(vertexBuffer); - size_t ibSize = indexBuffer->gpuMemorySize(); - int maxInstancesPerDraw = static_cast<int>(ibSize / (sizeof(uint16_t) * indicesPerInstance)); - - fVertices.initInstanced(primType, vertexBuffer, indexBuffer, - firstVertex, verticesPerInstance, indicesPerInstance, instancesToDraw, - maxInstancesPerDraw); - return vertices; -} - -void* GrVertexBatch::QuadHelper::init(GrBatchTarget* batchTarget, size_t vertexStride, - int quadsToDraw) { - SkAutoTUnref<const GrIndexBuffer> quadIndexBuffer( - batchTarget->resourceProvider()->refQuadIndexBuffer()); - if (!quadIndexBuffer) { - SkDebugf("Could not get quad index buffer."); - return NULL; - } - return this->INHERITED::init(batchTarget, kTriangles_GrPrimitiveType, vertexStride, - quadIndexBuffer, kVerticesPerQuad, kIndicesPerQuad, quadsToDraw); -} |