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

Side by Side Diff: src/gpu/GrReorderCommandBuilder.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/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(GrBatch* batch, 18 GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(GrDrawBatch* bat ch,
19 const GrCaps& ca ps) { 19 const GrCaps& ca ps) {
20 // Check if there is a Batch Draw we can batch with by linearly searching ba ck until we either 20 // Check if there is a Batch Draw we can batch with by linearly searching ba ck until we either
21 // 1) check every draw 21 // 1) check every draw
22 // 2) intersect with something 22 // 2) intersect with something
23 // 3) find a 'blocker' 23 // 3) find a 'blocker'
24 // Experimentally we have found that most batching occurs within the first 1 0 comparisons. 24 // Experimentally we have found that most batching occurs within the first 1 0 comparisons.
25 static const int kMaxLookback = 10; 25 static const int kMaxLookback = 10;
26 int i = 0; 26 int i = 0;
27 27
28 GrRenderTarget* rt = batch->pipeline()->getRenderTarget(); 28 GrRenderTarget* rt = batch->pipeline()->getRenderTarget();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 #endif 100 #endif
101 } 101 }
102 #if GR_BATCH_SPEW 102 #if GR_BATCH_SPEW
103 else { 103 else {
104 GrBATCH_INFO("\t\tBreaking because empty command buffer\n"); 104 GrBATCH_INFO("\t\tBreaking because empty command buffer\n");
105 } 105 }
106 #endif 106 #endif
107 107
108 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (batch, this- >batchTarget())); 108 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (batch, this- >batchTarget()));
109 } 109 }
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