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

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

Issue 1332923003: Remove batchtracker (Closed) Base URL: https://skia.googlesource.com/skia.git@latecreatepathprocessor
Patch Set: tweaks Created 5 years, 3 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/GrGLPathProcessor.h ('k') | src/gpu/gl/GrGLPrimitiveProcessor.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 2013 Google Inc. 2 * Copyright 2013 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 "GrGLPathProcessor.h" 8 #include "GrGLPathProcessor.h"
9 9
10 #include "GrPathProcessor.h" 10 #include "GrPathProcessor.h"
11 #include "GrGLGpu.h" 11 #include "GrGLGpu.h"
12 #include "GrGLPathRendering.h" 12 #include "GrGLPathRendering.h"
13 13
14 GrGLPathProcessor::GrGLPathProcessor(const GrPathProcessor&, const GrBatchTracke r&) 14 GrGLPathProcessor::GrGLPathProcessor()
15 : fColor(GrColor_ILLEGAL) {} 15 : fColor(GrColor_ILLEGAL) {}
16 16
17 void GrGLPathProcessor::emitCode(EmitArgs& args) { 17 void GrGLPathProcessor::emitCode(EmitArgs& args) {
18 GrGLGPBuilder* pb = args.fPB; 18 GrGLGPBuilder* pb = args.fPB;
19 GrGLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder(); 19 GrGLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder();
20 const GrPathProcessor& pathProc = args.fGP.cast<GrPathProcessor>(); 20 const GrPathProcessor& pathProc = args.fGP.cast<GrPathProcessor>();
21 21
22 // emit transforms 22 // emit transforms
23 this->emitTransforms(args.fPB, args.fTransformsIn, args.fTransformsOut); 23 this->emitTransforms(args.fPB, args.fTransformsIn, args.fTransformsOut);
24 24
25 // Setup uniform color 25 // Setup uniform color
26 if (pathProc.opts().readsColor()) { 26 if (pathProc.opts().readsColor()) {
27 const char* stagedLocalVarName; 27 const char* stagedLocalVarName;
28 fColorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility, 28 fColorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
29 kVec4f_GrSLType, 29 kVec4f_GrSLType,
30 kDefault_GrSLPrecision, 30 kDefault_GrSLPrecision,
31 "Color", 31 "Color",
32 &stagedLocalVarName); 32 &stagedLocalVarName);
33 fs->codeAppendf("%s = %s;", args.fOutputColor, stagedLocalVarName); 33 fs->codeAppendf("%s = %s;", args.fOutputColor, stagedLocalVarName);
34 } 34 }
35 35
36 // setup constant solid coverage 36 // setup constant solid coverage
37 if (pathProc.opts().readsCoverage()) { 37 if (pathProc.opts().readsCoverage()) {
38 fs->codeAppendf("%s = vec4(1);", args.fOutputCoverage); 38 fs->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
39 } 39 }
40 } 40 }
41 41
42 void GrGLPathProcessor::GenKey(const GrPathProcessor& pathProc, 42 void GrGLPathProcessor::GenKey(const GrPathProcessor& pathProc,
43 const GrBatchTracker& bt,
44 const GrGLSLCaps&, 43 const GrGLSLCaps&,
45 GrProcessorKeyBuilder* b) { 44 GrProcessorKeyBuilder* b) {
46 b->add32(SkToInt(pathProc.opts().readsColor()) | 45 b->add32(SkToInt(pathProc.opts().readsColor()) |
47 SkToInt(pathProc.opts().readsCoverage()) << 16); 46 SkToInt(pathProc.opts().readsCoverage()) << 16);
48 } 47 }
49 48
50 void GrGLPathProcessor::setData(const GrGLProgramDataManager& pdman, 49 void GrGLPathProcessor::setData(const GrGLProgramDataManager& pdman,
51 const GrPrimitiveProcessor& primProc, 50 const GrPrimitiveProcessor& primProc) {
52 const GrBatchTracker& bt) {
53 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); 51 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
54 if (pathProc.opts().readsColor() && pathProc.color() != fColor) { 52 if (pathProc.opts().readsColor() && pathProc.color() != fColor) {
55 GrGLfloat c[4]; 53 GrGLfloat c[4];
56 GrColorToRGBAFloat(pathProc.color(), c); 54 GrColorToRGBAFloat(pathProc.color(), c);
57 pdman.set4fv(fColorUniform, 1, c); 55 pdman.set4fv(fColorUniform, 1, c);
58 fColor = pathProc.color(); 56 fColor = pathProc.color();
59 } 57 }
60 } 58 }
61 59
62 void GrGLPathProcessor::emitTransforms(GrGLGPBuilder* pb, const TransformsIn& ti n, 60 void GrGLPathProcessor::emitTransforms(GrGLGPBuilder* pb, const TransformsIn& ti n,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 continue; 98 continue;
101 } 99 }
102 transforms[t].fCurrentValue = transform; 100 transforms[t].fCurrentValue = transform;
103 101
104 SkASSERT(transforms[t].fType == kVec2f_GrSLType || 102 SkASSERT(transforms[t].fType == kVec2f_GrSLType ||
105 transforms[t].fType == kVec3f_GrSLType); 103 transforms[t].fType == kVec3f_GrSLType);
106 unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3; 104 unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3;
107 pdman.setPathFragmentInputTransform(transforms[t].fHandle.handle(), comp onents, transform); 105 pdman.setPathFragmentInputTransform(transforms[t].fHandle.handle(), comp onents, transform);
108 } 106 }
109 } 107 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLPathProcessor.h ('k') | src/gpu/gl/GrGLPrimitiveProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698