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/GrPathProcessor.cpp

Issue 1961093002: Break apart shared use of varying and uniform transforms (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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
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 "GrPathProcessor.h" 8 #include "GrPathProcessor.h"
9 9
10 #include "gl/GrGLGpu.h" 10 #include "gl/GrGLGpu.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 pd.set4fv(fColorUniform, 1, c); 90 pd.set4fv(fColorUniform, 1, c);
91 fColor = pathProc.color(); 91 fColor = pathProc.color();
92 } 92 }
93 } 93 }
94 94
95 void setTransformData(const GrPrimitiveProcessor& primProc, 95 void setTransformData(const GrPrimitiveProcessor& primProc,
96 const GrGLSLProgramDataManager& pdman, 96 const GrGLSLProgramDataManager& pdman,
97 int index, 97 int index,
98 const SkTArray<const GrCoordTransform*, true>& coordTr ansforms) override { 98 const SkTArray<const GrCoordTransform*, true>& coordTr ansforms) override {
99 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); 99 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
100 SkSTArray<2, Transform, true>& transforms = fInstalledTransforms[index]; 100 SkSTArray<2, VaryingTransform, true>& transforms = fInstalledTransforms[ index];
101 int numTransforms = transforms.count(); 101 int numTransforms = transforms.count();
102 for (int t = 0; t < numTransforms; ++t) { 102 for (int t = 0; t < numTransforms; ++t) {
103 SkASSERT(transforms[t].fHandle.isValid()); 103 SkASSERT(transforms[t].fHandle.isValid());
104 const SkMatrix& transform = GetTransformMatrix(pathProc.localMatrix( ), 104 const SkMatrix& transform = GetTransformMatrix(pathProc.localMatrix( ),
105 *coordTransforms[t]); 105 *coordTransforms[t]);
106 if (transforms[t].fCurrentValue.cheapEqualTo(transform)) { 106 if (transforms[t].fCurrentValue.cheapEqualTo(transform)) {
107 continue; 107 continue;
108 } 108 }
109 transforms[t].fCurrentValue = transform; 109 transforms[t].fCurrentValue = transform;
110 110
111 SkASSERT(transforms[t].fType == kVec2f_GrSLType || 111 SkASSERT(transforms[t].fType == kVec2f_GrSLType ||
112 transforms[t].fType == kVec3f_GrSLType); 112 transforms[t].fType == kVec3f_GrSLType);
113 unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3 ; 113 unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3 ;
114 pdman.setPathFragmentInputTransform(transforms[t].fHandle, component s, transform); 114 pdman.setPathFragmentInputTransform(transforms[t].fHandle, component s, transform);
115 } 115 }
116 } 116 }
117 117
118 private: 118 private:
119 typedef GrGLSLProgramDataManager::VaryingHandle VaryingHandle;
robertphillips 2016/05/09 16:51:28 init fHandle here ?
egdaniel 2016/05/09 16:59:05 The default ctor of a ResourceHandle sets the hand
120 struct VaryingTransform : public Transform {
121 VaryingTransform() : Transform() {}
122 VaryingHandle fHandle;
123 };
124
125 SkSTArray<8, SkSTArray<2, VaryingTransform, true> > fInstalledTransforms;
126
119 UniformHandle fColorUniform; 127 UniformHandle fColorUniform;
120 GrColor fColor; 128 GrColor fColor;
121 129
122 typedef GrGLSLPrimitiveProcessor INHERITED; 130 typedef GrGLSLPrimitiveProcessor INHERITED;
123 }; 131 };
124 132
125 GrPathProcessor::GrPathProcessor(GrColor color, 133 GrPathProcessor::GrPathProcessor(GrColor color,
126 const GrXPOverridesForBatch& overrides, 134 const GrXPOverridesForBatch& overrides,
127 const SkMatrix& viewMatrix, 135 const SkMatrix& viewMatrix,
128 const SkMatrix& localMatrix) 136 const SkMatrix& localMatrix)
129 : fColor(color) 137 : fColor(color)
130 , fViewMatrix(viewMatrix) 138 , fViewMatrix(viewMatrix)
131 , fLocalMatrix(localMatrix) 139 , fLocalMatrix(localMatrix)
132 , fOverrides(overrides) { 140 , fOverrides(overrides) {
133 this->initClassID<GrPathProcessor>(); 141 this->initClassID<GrPathProcessor>();
134 } 142 }
135 143
136 void GrPathProcessor::getGLSLProcessorKey(const GrGLSLCaps& caps, 144 void GrPathProcessor::getGLSLProcessorKey(const GrGLSLCaps& caps,
137 GrProcessorKeyBuilder* b) const { 145 GrProcessorKeyBuilder* b) const {
138 GrGLPathProcessor::GenKey(*this, caps, b); 146 GrGLPathProcessor::GenKey(*this, caps, b);
139 } 147 }
140 148
141 GrGLSLPrimitiveProcessor* GrPathProcessor::createGLSLInstance(const GrGLSLCaps& caps) const { 149 GrGLSLPrimitiveProcessor* GrPathProcessor::createGLSLInstance(const GrGLSLCaps& caps) const {
142 SkASSERT(caps.pathRenderingSupport()); 150 SkASSERT(caps.pathRenderingSupport());
143 return new GrGLPathProcessor(); 151 return new GrGLPathProcessor();
144 } 152 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/glsl/GrGLSLGeometryProcessor.h » ('j') | src/gpu/glsl/GrGLSLGeometryProcessor.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698