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

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

Issue 1282893002: Make initBatchTracker private, move towards pipeline on batch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GrReorderCommandBuilder.h ('k') | src/gpu/GrTargetCommands.h » ('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 "GrReorderCommandBuilder.h" 8 #include "GrReorderCommandBuilder.h"
9 9
10 template <class Left, class Right> 10 template <class Left, class Right>
11 static bool intersect(const Left& a, const Right& b) { 11 static bool intersect(const Left& a, const Right& b) {
12 SkASSERT(a.fLeft <= a.fRight && a.fTop <= a.fBottom && 12 SkASSERT(a.fLeft <= a.fRight && a.fTop <= a.fBottom &&
13 b.fLeft <= b.fRight && b.fTop <= b.fBottom); 13 b.fLeft <= b.fRight && b.fTop <= b.fBottom);
14 return a.fLeft < b.fRight && b.fLeft < a.fRight && 14 return a.fLeft < b.fRight && b.fLeft < a.fRight &&
15 a.fTop < b.fBottom && b.fTop < a.fBottom; 15 a.fTop < b.fBottom && b.fTop < a.fBottom;
16 } 16 }
17 17
18 GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(State* state, Gr Batch* batch) { 18 GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(const State* sta te,
19 const GrPipeline Optimizations& opts,
20 GrBatch* batch) {
19 // Check if there is a Batch Draw we can batch with by linearly searching ba ck until we either 21 // Check if there is a Batch Draw we can batch with by linearly searching ba ck until we either
20 // 1) check every draw 22 // 1) check every draw
21 // 2) intersect with something 23 // 2) intersect with something
22 // 3) find a 'blocker' 24 // 3) find a 'blocker'
23 // Experimentally we have found that most batching occurs within the first 1 0 comparisons. 25 // Experimentally we have found that most batching occurs within the first 1 0 comparisons.
24 static const int kMaxLookback = 10; 26 static const int kMaxLookback = 10;
25 int i = 0; 27 int i = 0;
brucedawson 2015/08/11 18:57:39 If this variable was declared on line 52 then it w
26 batch->setPipeline(state->getPipeline()); 28 batch->setPipeline(state->getPipeline(), opts);
27 GrRenderTarget* rt = state->getPipeline()->getRenderTarget(); 29 GrRenderTarget* rt = state->getPipeline()->getRenderTarget();
28 30
29 GrBATCH_INFO("Re-Recording (%s, B%u)\n" 31 GrBATCH_INFO("Re-Recording (%s, B%u)\n"
30 "\tRenderTarget %p\n" 32 "\tRenderTarget %p\n"
31 "\tBounds (%f, %f, %f, %f)\n", 33 "\tBounds (%f, %f, %f, %f)\n",
32 batch->name(), 34 batch->name(),
33 batch->uniqueID(), rt, 35 batch->uniqueID(), rt,
34 batch->bounds().fLeft, batch->bounds().fRight, 36 batch->bounds().fLeft, batch->bounds().fRight,
35 batch->bounds().fTop, batch->bounds().fBottom); 37 batch->bounds().fTop, batch->bounds().fBottom);
36 #if GR_BATCH_SPEW 38 if (GR_BATCH_SPEW) {
37 SkDebugf("\tColorStages:\n"); 39 SkDebugf("\tColorStages:\n");
38 for (int i = 0; i < state->getPipeline()->numColorFragmentStages(); i++) { 40 for (int i = 0; i < state->getPipeline()->numColorFragmentStages(); i++) {
39 SkDebugf("\t\t%s\n", state->getPipeline()->getColorStage(i).processor()- >name()); 41 SkDebugf("\t\t%s\n", state->getPipeline()->getColorStage(i).processo r()->name());
42 }
43 SkDebugf("\tCoverageStages:\n");
44 for (int i = 0; i < state->getPipeline()->numCoverageFragmentStages(); i ++) {
45 SkDebugf("\t\t%s\n", state->getPipeline()->getCoverageStage(i).proce ssor()->name());
46 }
47 SkDebugf("\tXP: %s\n", state->getPipeline()->getXferProcessor()->name()) ;
40 } 48 }
41 SkDebugf("\tCoverageStages:\n");
42 for (int i = 0; i < state->getPipeline()->numCoverageFragmentStages(); i++) {
43 SkDebugf("\t\t%s\n", state->getPipeline()->getCoverageStage(i).processor ()->name());
44 }
45 SkDebugf("\tXP: %s\n", state->getPipeline()->getXferProcessor()->name());
46 #endif
47 GrBATCH_INFO("\tOutcome:\n"); 49 GrBATCH_INFO("\tOutcome:\n");
48 if (!this->cmdBuffer()->empty()) { 50 if (!this->cmdBuffer()->empty()) {
49 GrTargetCommands::CmdBuffer::ReverseIter reverseIter(*this->cmdBuffer()) ; 51 GrTargetCommands::CmdBuffer::ReverseIter reverseIter(*this->cmdBuffer()) ;
50 52
51 do { 53 do {
52 if (Cmd::kDrawBatch_CmdType == reverseIter->type()) { 54 if (Cmd::kDrawBatch_CmdType == reverseIter->type()) {
53 DrawBatch* previous = static_cast<DrawBatch*>(reverseIter.get()) ; 55 DrawBatch* previous = static_cast<DrawBatch*>(reverseIter.get()) ;
54 56
55 if (previous->fBatch->pipeline()->getRenderTarget() != rt) { 57 if (previous->fBatch->pipeline()->getRenderTarget() != rt) {
56 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget \n", 58 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget \n",
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 102 }
101 #if GR_BATCH_SPEW 103 #if GR_BATCH_SPEW
102 else { 104 else {
103 GrBATCH_INFO("\t\tBreaking because empty command buffer\n"); 105 GrBATCH_INFO("\t\tBreaking because empty command buffer\n");
104 } 106 }
105 #endif 107 #endif
106 108
107 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch , 109 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch ,
108 this->batchT arget())); 110 this->batchT arget()));
109 } 111 }
OLDNEW
« no previous file with comments | « src/gpu/GrReorderCommandBuilder.h ('k') | src/gpu/GrTargetCommands.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698