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

Side by Side Diff: src/gpu/GrTargetCommands.cpp

Issue 1293583002: Introduce GrBatch subclasses GrDrawBatch and GrVertexBatch to prepare for non-drawing batches (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove duplicated fields in GrVertexBatch Created 5 years, 4 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/GrTargetCommands.h ('k') | src/gpu/GrTessellatingPathRenderer.cpp » ('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 7
8 #include "GrTargetCommands.h" 8 #include "GrTargetCommands.h"
9 9
10 #include "GrBufferedDrawTarget.h" 10 #include "GrBufferedDrawTarget.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 GrGpu* gpu = bufferedDrawTarget->getGpu(); 25 GrGpu* gpu = bufferedDrawTarget->getGpu();
26 26
27 // Loop over all batches and generate geometry 27 // Loop over all batches and generate geometry
28 CmdBuffer::Iter genIter(fCmdBuffer); 28 CmdBuffer::Iter genIter(fCmdBuffer);
29 while (genIter.next()) { 29 while (genIter.next()) {
30 if (Cmd::kDrawBatch_CmdType == genIter->type()) { 30 if (Cmd::kDrawBatch_CmdType == genIter->type()) {
31 DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get()); 31 DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get());
32 fBatchTarget.resetNumberOfDraws(); 32 fBatchTarget.resetNumberOfDraws();
33 db->batch()->generateGeometry(&fBatchTarget); 33 // TODO: encapsulate the specialization of GrVertexBatch in GrVertex Batch so that we can
34 db->batch()->setNumberOfDraws(fBatchTarget.numberOfDraws()); 34 // remove this cast. Currently all GrDrawBatches are in fact GrVerte xBatch.
35 GrVertexBatch* vertexBatch = static_cast<GrVertexBatch*>(db->batch() );
36
37 vertexBatch->generateGeometry(&fBatchTarget);
38 vertexBatch->setNumberOfDraws(fBatchTarget.numberOfDraws());
35 } 39 }
36 } 40 }
37 41
38 fBatchTarget.preFlush(); 42 fBatchTarget.preFlush();
39 43
40 CmdBuffer::Iter iter(fCmdBuffer); 44 CmdBuffer::Iter iter(fCmdBuffer);
41 45
42 while (iter.next()) { 46 while (iter.next()) {
43 iter->execute(gpu); 47 iter->execute(gpu);
44 } 48 }
(...skipping 24 matching lines...) Expand all
69 fState->fBatchTracker); 73 fState->fBatchTracker);
70 fState->fCompiled = true; 74 fState->fCompiled = true;
71 } 75 }
72 GrPathRendering::DrawPathArgs args(fState->fPrimitiveProcessor.get(), fState ->getPipeline(), 76 GrPathRendering::DrawPathArgs args(fState->fPrimitiveProcessor.get(), fState ->getPipeline(),
73 &fState->fDesc, &fState->fBatchTracker, & fStencilSettings); 77 &fState->fDesc, &fState->fBatchTracker, & fStencilSettings);
74 gpu->pathRendering()->drawPaths(args, this->pathRange(), fIndices, fIndexTyp e, fTransforms, 78 gpu->pathRendering()->drawPaths(args, this->pathRange(), fIndices, fIndexTyp e, fTransforms,
75 fTransformType, fCount); 79 fTransformType, fCount);
76 } 80 }
77 81
78 void GrTargetCommands::DrawBatch::execute(GrGpu* gpu) { 82 void GrTargetCommands::DrawBatch::execute(GrGpu* gpu) {
79 fBatchTarget->flushNext(fBatch->numberOfDraws()); 83 // TODO: encapsulate the specialization of GrVertexBatch in GrVertexBatch so that we can
84 // remove this cast. Currently all GrDrawBatches are in fact GrVertexBatch.
85 const GrVertexBatch* vertexBatch = static_cast<const GrVertexBatch*>(fBatch. get());
86 fBatchTarget->flushNext(vertexBatch->numberOfDraws());
80 } 87 }
81 88
82 void GrTargetCommands::Clear::execute(GrGpu* gpu) { 89 void GrTargetCommands::Clear::execute(GrGpu* gpu) {
83 if (GrColor_ILLEGAL == fColor) { 90 if (GrColor_ILLEGAL == fColor) {
84 gpu->discard(this->renderTarget()); 91 gpu->discard(this->renderTarget());
85 } else { 92 } else {
86 gpu->clear(fRect, fColor, this->renderTarget()); 93 gpu->clear(fRect, fColor, this->renderTarget());
87 } 94 }
88 } 95 }
89 96
90 void GrTargetCommands::ClearStencilClip::execute(GrGpu* gpu) { 97 void GrTargetCommands::ClearStencilClip::execute(GrGpu* gpu) {
91 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); 98 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget());
92 } 99 }
93 100
94 void GrTargetCommands::CopySurface::execute(GrGpu* gpu) { 101 void GrTargetCommands::CopySurface::execute(GrGpu* gpu) {
95 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); 102 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint);
96 } 103 }
OLDNEW
« no previous file with comments | « src/gpu/GrTargetCommands.h ('k') | src/gpu/GrTessellatingPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698