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

Side by Side Diff: src/gpu/gl/GrGLPathRendering.cpp

Issue 1806983002: Update how we send draws to gpu backend to reduce state setting. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 4 years, 9 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/gl/GrGLPathRendering.h ('k') | src/gpu/gl/GrGLVaryingHandler.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 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 "gl/GrGLPathRendering.h" 8 #include "gl/GrGLPathRendering.h"
9 #include "gl/GrGLUtil.h" 9 #include "gl/GrGLUtil.h"
10 #include "gl/GrGLGpu.h" 10 #include "gl/GrGLGpu.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face); 135 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face);
136 136
137 if (glPath->shouldFill()) { 137 if (glPath->shouldFill()) {
138 GL_CALL(StencilFillPath(glPath->pathID(), fillMode, writeMask)); 138 GL_CALL(StencilFillPath(glPath->pathID(), fillMode, writeMask));
139 } 139 }
140 if (glPath->shouldStroke()) { 140 if (glPath->shouldStroke()) {
141 GL_CALL(StencilStrokePath(glPath->pathID(), 0xffff, writeMask)); 141 GL_CALL(StencilStrokePath(glPath->pathID(), 0xffff, writeMask));
142 } 142 }
143 } 143 }
144 144
145 void GrGLPathRendering::onDrawPath(const DrawPathArgs& args, const GrPath* path) { 145 void GrGLPathRendering::onDrawPath(const GrPipeline& pipeline,
146 if (!this->gpu()->flushGLState(args)) { 146 const GrPrimitiveProcessor& primProc,
147 const GrStencilSettings& stencil,
148 const GrPath* path) {
149 if (!this->gpu()->flushGLState(pipeline, primProc)) {
147 return; 150 return;
148 } 151 }
149 const GrGLPath* glPath = static_cast<const GrGLPath*>(path); 152 const GrGLPath* glPath = static_cast<const GrGLPath*>(path);
150 153
151 this->flushPathStencilSettings(*args.fStencil); 154 this->flushPathStencilSettings(stencil);
152 SkASSERT(!fHWPathStencilSettings.isTwoSided()); 155 SkASSERT(!fHWPathStencilSettings.isTwoSided());
153 156
154 GrGLenum fillMode = gr_stencil_op_to_gl_path_rendering_fill_mode( 157 GrGLenum fillMode = gr_stencil_op_to_gl_path_rendering_fill_mode(
155 fHWPathStencilSettings.passOp(GrStencilSettings::kFront_Face)); 158 fHWPathStencilSettings.passOp(GrStencilSettings::kFront_Face));
156 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face); 159 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face);
157 160
158 if (glPath->shouldStroke()) { 161 if (glPath->shouldStroke()) {
159 if (glPath->shouldFill()) { 162 if (glPath->shouldFill()) {
160 GL_CALL(StencilFillPath(glPath->pathID(), fillMode, writeMask)); 163 GL_CALL(StencilFillPath(glPath->pathID(), fillMode, writeMask));
161 } 164 }
162 GL_CALL(StencilThenCoverStrokePath(glPath->pathID(), 0xffff, writeMask, 165 GL_CALL(StencilThenCoverStrokePath(glPath->pathID(), 0xffff, writeMask,
163 GR_GL_BOUNDING_BOX)); 166 GR_GL_BOUNDING_BOX));
164 } else { 167 } else {
165 GL_CALL(StencilThenCoverFillPath(glPath->pathID(), fillMode, writeMask, 168 GL_CALL(StencilThenCoverFillPath(glPath->pathID(), fillMode, writeMask,
166 GR_GL_BOUNDING_BOX)); 169 GR_GL_BOUNDING_BOX));
167 } 170 }
168 } 171 }
169 172
170 void GrGLPathRendering::onDrawPaths(const DrawPathArgs& args, const GrPathRange* pathRange, 173 void GrGLPathRendering::onDrawPaths(const GrPipeline& pipeline,
174 const GrPrimitiveProcessor& primProc,
175 const GrStencilSettings& stencil, const GrPa thRange* pathRange,
171 const void* indices, PathIndexType indexType , 176 const void* indices, PathIndexType indexType ,
172 const float transformValues[], PathTransform Type transformType, 177 const float transformValues[], PathTransform Type transformType,
173 int count) { 178 int count) {
174 SkDEBUGCODE(verify_floats(transformValues, gXformType2ComponentCount[transfo rmType] * count)); 179 SkDEBUGCODE(verify_floats(transformValues, gXformType2ComponentCount[transfo rmType] * count));
175 180
176 if (!this->gpu()->flushGLState(args)) { 181 if (!this->gpu()->flushGLState(pipeline, primProc)) {
177 return; 182 return;
178 } 183 }
179 this->flushPathStencilSettings(*args.fStencil); 184 this->flushPathStencilSettings(stencil);
180 SkASSERT(!fHWPathStencilSettings.isTwoSided()); 185 SkASSERT(!fHWPathStencilSettings.isTwoSided());
181 186
182 187
183 const GrGLPathRange* glPathRange = static_cast<const GrGLPathRange*>(pathRan ge); 188 const GrGLPathRange* glPathRange = static_cast<const GrGLPathRange*>(pathRan ge);
184 189
185 GrGLenum fillMode = 190 GrGLenum fillMode =
186 gr_stencil_op_to_gl_path_rendering_fill_mode( 191 gr_stencil_op_to_gl_path_rendering_fill_mode(
187 fHWPathStencilSettings.passOp(GrStencilSettings::kFront_Face)); 192 fHWPathStencilSettings.passOp(GrStencilSettings::kFront_Face));
188 GrGLint writeMask = 193 GrGLint writeMask =
189 fHWPathStencilSettings.writeMask(GrStencilSettings::kFront_Face); 194 fHWPathStencilSettings.writeMask(GrStencilSettings::kFront_Face);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 funcMask != fHWPathStencilSettings.funcMask(kFront_Face)) { 330 funcMask != fHWPathStencilSettings.funcMask(kFront_Face)) {
326 GL_CALL(PathStencilFunc(GrToGLStencilFunc(func), funcRef, funcMask)) ; 331 GL_CALL(PathStencilFunc(GrToGLStencilFunc(func), funcRef, funcMask)) ;
327 } 332 }
328 fHWPathStencilSettings = stencilSettings; 333 fHWPathStencilSettings = stencilSettings;
329 } 334 }
330 } 335 }
331 336
332 inline GrGLGpu* GrGLPathRendering::gpu() { 337 inline GrGLGpu* GrGLPathRendering::gpu() {
333 return static_cast<GrGLGpu*>(fGpu); 338 return static_cast<GrGLGpu*>(fGpu);
334 } 339 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.h ('k') | src/gpu/gl/GrGLVaryingHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698