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

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

Issue 816513003: Stop creating GrODS for stencilPath commands. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "GrOptDrawState.h" 8 #include "GrOptDrawState.h"
9 9
10 #include "GrDrawState.h" 10 #include "GrDrawState.h"
11 #include "GrDrawTargetCaps.h" 11 #include "GrDrawTargetCaps.h"
12 #include "GrGpu.h" 12 #include "GrGpu.h"
13 #include "GrProcOptInfo.h" 13 #include "GrProcOptInfo.h"
14 #include "GrXferProcessor.h" 14 #include "GrXferProcessor.h"
15 15
16 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, 16 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
17 const GrGeometryProcessor* gp, 17 const GrGeometryProcessor* gp,
18 const GrPathProcessor* pathProc, 18 const GrPathProcessor* pathProc,
19 const GrDrawTargetCaps& caps, 19 const GrDrawTargetCaps& caps,
20 const ScissorState& scissorState, 20 const GrScissorState& scissorState,
21 const GrDeviceCoordTexture* dstCopy, 21 const GrDeviceCoordTexture* dstCopy,
22 GrGpu::DrawType drawType) 22 GrGpu::DrawType drawType)
23 : fFinalized(false) { 23 : fFinalized(false) {
24 fDrawType = drawType; 24 fDrawType = drawType;
25 25
26 // Copy GeometryProcesssor from DS or ODS 26 // Copy GeometryProcesssor from DS or ODS
27 if (gp) { 27 if (gp) {
28 SkASSERT(!pathProc); 28 SkASSERT(!pathProc);
29 SkASSERT(!(GrGpu::IsPathRenderingDrawType(drawType) || 29 SkASSERT(!GrGpu::IsPathRenderingDrawType(drawType));
30 GrGpu::kStencilPath_DrawType == drawType));
31 fGeometryProcessor.reset(gp); 30 fGeometryProcessor.reset(gp);
32 fPrimitiveProcessor.reset(gp); 31 fPrimitiveProcessor.reset(gp);
33 } else { 32 } else {
34 SkASSERT(!gp && pathProc && (GrGpu::IsPathRenderingDrawType(drawType) || 33 SkASSERT(!gp && pathProc && GrGpu::IsPathRenderingDrawType(drawType));
35 GrGpu::kStencilPath_DrawType == drawType));
36 fPrimitiveProcessor.reset(pathProc); 34 fPrimitiveProcessor.reset(pathProc);
37 } 35 }
38 36
39 37
40 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(fPrimitiveProcessor) ; 38 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(fPrimitiveProcessor) ;
41 const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(fPrimitiveProc essor); 39 const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(fPrimitiveProc essor);
42 40
43 // Create XferProcessor from DS's XPFactory 41 // Create XferProcessor from DS's XPFactory
44 SkAutoTUnref<GrXferProcessor> xferProcessor( 42 SkAutoTUnref<GrXferProcessor> xferProcessor(
45 drawState.getXPFactory()->createXferProcessor(colorPOI, coveragePOI)); 43 drawState.getXPFactory()->createXferProcessor(colorPOI, coveragePOI));
(...skipping 12 matching lines...) Expand all
58 drawState.isCoverageDrawing() , 56 drawState.isCoverageDrawing() ,
59 drawState.isColorWriteDisable d(), 57 drawState.isColorWriteDisable d(),
60 drawState.getStencil().doesWr ite(), 58 drawState.getStencil().doesWr ite(),
61 &overrideColor, 59 &overrideColor,
62 caps); 60 caps);
63 } 61 }
64 62
65 // When path rendering the stencil settings are not always set on the draw s tate 63 // When path rendering the stencil settings are not always set on the draw s tate
66 // so we must check the draw type. In cases where we will skip drawing we si mply return a 64 // so we must check the draw type. In cases where we will skip drawing we si mply return a
67 // null GrOptDrawState. 65 // null GrOptDrawState.
68 if (!xferProcessor || ((GrXferProcessor::kSkipDraw_OptFlag & optFlags) && 66 if (!xferProcessor || (GrXferProcessor::kSkipDraw_OptFlag & optFlags)) {
69 GrGpu::kStencilPath_DrawType != drawType)) {
70 // Set the fields that don't default init and return. The lack of a rend er target will 67 // Set the fields that don't default init and return. The lack of a rend er target will
71 // indicate that this can be skipped. 68 // indicate that this can be skipped.
72 fFlags = 0; 69 fFlags = 0;
73 fDrawFace = GrDrawState::kInvalid_DrawFace; 70 fDrawFace = GrDrawState::kInvalid_DrawFace;
74 fViewMatrix.reset(); 71 fViewMatrix.reset();
75 return; 72 return;
76 } 73 }
77 74
78 fRenderTarget.reset(drawState.fRenderTarget.get()); 75 fRenderTarget.reset(drawState.fRenderTarget.get());
79 SkASSERT(fRenderTarget); 76 SkASSERT(fRenderTarget);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { 204 if (this->getFragmentStage(i) != that.getFragmentStage(i)) {
208 return false; 205 return false;
209 } 206 }
210 } 207 }
211 208
212 // Now update the GrPrimitiveProcessor's batch tracker 209 // Now update the GrPrimitiveProcessor's batch tracker
213 fPrimitiveProcessor->makeEqual(&fBatchTracker, that.getBatchTracker()); 210 fPrimitiveProcessor->makeEqual(&fBatchTracker, that.getBatchTracker());
214 return true; 211 return true;
215 } 212 }
216 213
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698