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

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

Issue 1278643006: Make GrBatch carry its own GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more 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/GrInOrderCommandBuilder.h ('k') | src/gpu/GrPipeline.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 "GrInOrderCommandBuilder.h" 8 #include "GrInOrderCommandBuilder.h"
9 9
10 #include "GrBufferedDrawTarget.h" 10 #include "GrBufferedDrawTarget.h"
11 11
12 #include "GrColor.h" 12 #include "GrColor.h"
13 #include "SkPoint.h" 13 #include "SkPoint.h"
14 14
15 static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettin gs) { 15 static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettin gs) {
16 static const GrStencilSettings::Face pathFace = GrStencilSettings::kFront_Fa ce; 16 static const GrStencilSettings::Face pathFace = GrStencilSettings::kFront_Fa ce;
17 bool isWinding = kInvert_StencilOp != pathStencilSettings.passOp(pathFace); 17 bool isWinding = kInvert_StencilOp != pathStencilSettings.passOp(pathFace);
18 if (isWinding) { 18 if (isWinding) {
19 // Double check that it is in fact winding. 19 // Double check that it is in fact winding.
20 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.passOp(pathFace)); 20 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.passOp(pathFace));
21 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.failOp(pathFace)); 21 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.failOp(pathFace));
22 SkASSERT(0x1 != pathStencilSettings.writeMask(pathFace)); 22 SkASSERT(0x1 != pathStencilSettings.writeMask(pathFace));
23 SkASSERT(!pathStencilSettings.isTwoSided()); 23 SkASSERT(!pathStencilSettings.isTwoSided());
24 } 24 }
25 return isWinding; 25 return isWinding;
26 } 26 }
27 27
28 GrTargetCommands::Cmd* GrInOrderCommandBuilder::recordDrawBatch(const State* sta te, 28 GrTargetCommands::Cmd* GrInOrderCommandBuilder::recordDrawBatch(GrBatch* batch) {
29 const GrPipeline Optimizations& opts,
30 GrBatch* batch) {
31 // Check if there is a Batch Draw we can batch with
32 batch->setPipeline(state->getPipeline(), opts);
33 GrBATCH_INFO("In-Recording (%s, %u)\n", batch->name(), batch->uniqueID()); 29 GrBATCH_INFO("In-Recording (%s, %u)\n", batch->name(), batch->uniqueID());
34 if (!this->cmdBuffer()->empty() && 30 if (!this->cmdBuffer()->empty() &&
35 Cmd::kDrawBatch_CmdType == this->cmdBuffer()->back().type()) { 31 Cmd::kDrawBatch_CmdType == this->cmdBuffer()->back().type()) {
36 DrawBatch* previous = static_cast<DrawBatch*>(&this->cmdBuffer()->back() ); 32 DrawBatch* previous = static_cast<DrawBatch*>(&this->cmdBuffer()->back() );
37 if (previous->fState == state && previous->fBatch->combineIfPossible(bat ch)) { 33 if (previous->batch()->combineIfPossible(batch)) {
38 GrBATCH_INFO("\tBatching with (%s, %u)\n", 34 GrBATCH_INFO("\tBatching with (%s, %u)\n",
39 previous->fBatch->name(), previous->fBatch->uniqueID()) ; 35 previous->fBatch->name(), previous->fBatch->uniqueID()) ;
40 return NULL; 36 return NULL;
41 } 37 }
42 } 38 }
43 39
44 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch , 40 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (batch, this- >batchTarget()));
45 this->batchT arget()));
46 } 41 }
47 42
48 GrTargetCommands::Cmd* 43 GrTargetCommands::Cmd*
49 GrInOrderCommandBuilder::recordStencilPath(const GrPipelineBuilder& pipelineBuil der, 44 GrInOrderCommandBuilder::recordStencilPath(const GrPipelineBuilder& pipelineBuil der,
50 const GrPathProcessor* pathProc, 45 const GrPathProcessor* pathProc,
51 const GrPath* path, 46 const GrPath* path,
52 const GrScissorState& scissorState, 47 const GrScissorState& scissorState,
53 const GrStencilSettings& stencilSetti ngs) { 48 const GrStencilSettings& stencilSetti ngs) {
54 StencilPath* sp = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), StencilPath, 49 StencilPath* sp = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), StencilPath,
55 (path, pipelineBuilder.getRenderT arget())); 50 (path, pipelineBuilder.getRenderT arget()));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 120
126 DrawPaths* dp = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawPaths, (sta te, pathRange)); 121 DrawPaths* dp = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawPaths, (sta te, pathRange));
127 dp->fIndices = savedIndices; 122 dp->fIndices = savedIndices;
128 dp->fIndexType = indexType; 123 dp->fIndexType = indexType;
129 dp->fTransforms = savedTransforms; 124 dp->fTransforms = savedTransforms;
130 dp->fTransformType = transformType; 125 dp->fTransformType = transformType;
131 dp->fCount = count; 126 dp->fCount = count;
132 dp->fStencilSettings = stencilSettings; 127 dp->fStencilSettings = stencilSettings;
133 return dp; 128 return dp;
134 } 129 }
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderCommandBuilder.h ('k') | src/gpu/GrPipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698