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

Side by Side Diff: src/gpu/batches/GrMSAAPathRenderer.cpp

Issue 2339203002: Stop flattening GrCoordTransforms in parent GrFragmentProcessors. (Closed)
Patch Set: Fix issue of taking ref to a temporary Created 4 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/batches/GrAnalyticRectBatch.cpp ('k') | src/gpu/batches/GrPLSPathRenderer.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 2016 Google Inc. 2 * Copyright 2016 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 "GrMSAAPathRenderer.h" 8 #include "GrMSAAPathRenderer.h"
9 9
10 #include "GrAuditTrail.h" 10 #include "GrAuditTrail.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 GrGLSLVertToFrag uv(kVec2f_GrSLType); 141 GrGLSLVertToFrag uv(kVec2f_GrSLType);
142 varyingHandler->addVarying("uv", &uv, kHigh_GrSLPrecision); 142 varyingHandler->addVarying("uv", &uv, kHigh_GrSLPrecision);
143 vsBuilder->codeAppendf("%s = %s;", uv.vsOut(), qp.inUV()->fName); 143 vsBuilder->codeAppendf("%s = %s;", uv.vsOut(), qp.inUV()->fName);
144 144
145 // Setup position 145 // Setup position
146 this->setupPosition(vsBuilder, uniformHandler, gpArgs, qp.inPosition ()->fName, 146 this->setupPosition(vsBuilder, uniformHandler, gpArgs, qp.inPosition ()->fName,
147 qp.viewMatrix(), &fViewMatrixUniform); 147 qp.viewMatrix(), &fViewMatrixUniform);
148 148
149 // emit transforms 149 // emit transforms
150 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr gs->fPositionVar, 150 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr gs->fPositionVar,
151 qp.inPosition()->fName, SkMatrix::I(), args.fTr ansformsIn, 151 qp.inPosition()->fName, SkMatrix::I(),
152 args.fTransformsOut); 152 args.fFPCoordTransformHandler);
153 153
154 GrGLSLPPFragmentBuilder* fsBuilder = args.fFragBuilder; 154 GrGLSLPPFragmentBuilder* fsBuilder = args.fFragBuilder;
155 fsBuilder->codeAppendf("if (%s.x * %s.x >= %s.y) discard;", uv.fsIn( ), uv.fsIn(), 155 fsBuilder->codeAppendf("if (%s.x * %s.x >= %s.y) discard;", uv.fsIn( ), uv.fsIn(),
156 uv.fsIn( )); 156 uv.fsIn( ));
157 fsBuilder->codeAppendf("%s = vec4(1.0);", args.fOutputCoverage); 157 fsBuilder->codeAppendf("%s = vec4(1.0);", args.fOutputCoverage);
158 } 158 }
159 159
160 static inline void GenKey(const GrGeometryProcessor& gp, 160 static inline void GenKey(const GrGeometryProcessor& gp,
161 const GrGLSLCaps&, 161 const GrGLSLCaps&,
162 GrProcessorKeyBuilder* b) { 162 GrProcessorKeyBuilder* b) {
163 const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>(); 163 const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>();
164 uint32_t key = 0; 164 uint32_t key = 0;
165 key |= qp.viewMatrix().hasPerspective() ? 0x1 : 0x0; 165 key |= qp.viewMatrix().hasPerspective() ? 0x1 : 0x0;
166 key |= qp.viewMatrix().isIdentity() ? 0x2: 0x0; 166 key |= qp.viewMatrix().isIdentity() ? 0x2: 0x0;
167 b->add32(key); 167 b->add32(key);
168 } 168 }
169 169
170 virtual void setData(const GrGLSLProgramDataManager& pdman, 170 void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitivePro cessor& gp,
171 const GrPrimitiveProcessor& gp) override { 171 FPCoordTransformIter&& transformIter) override {
172 const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>(); 172 const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>();
173 if (!qp.viewMatrix().isIdentity()) { 173 if (!qp.viewMatrix().isIdentity()) {
174 float viewMatrix[3 * 3]; 174 float viewMatrix[3 * 3];
175 GrGLSLGetMatrix<3>(viewMatrix, qp.viewMatrix()); 175 GrGLSLGetMatrix<3>(viewMatrix, qp.viewMatrix());
176 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); 176 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
177 } 177 }
178 this->setTransformDataHelper(SkMatrix::I(), pdman, &transformIter);
178 } 179 }
179 180
180 private: 181 private:
181 typedef GrGLSLGeometryProcessor INHERITED; 182 typedef GrGLSLGeometryProcessor INHERITED;
182 183
183 UniformHandle fViewMatrixUniform; 184 UniformHandle fViewMatrixUniform;
184 }; 185 };
185 186
186 virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, 187 virtual void getGLSLProcessorKey(const GrGLSLCaps& caps,
187 GrProcessorKeyBuilder* b) const override { 188 GrProcessorKeyBuilder* b) const override {
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 707
707 GrPaint paint; 708 GrPaint paint;
708 paint.setXPFactory(GrDisableColorXPFactory::Make()); 709 paint.setXPFactory(GrDisableColorXPFactory::Make());
709 paint.setAntiAlias(args.fIsAA); 710 paint.setAntiAlias(args.fIsAA);
710 711
711 this->internalDrawPath(args.fDrawContext, paint, GrUserStencilSettings::kUnu sed, *args.fClip, 712 this->internalDrawPath(args.fDrawContext, paint, GrUserStencilSettings::kUnu sed, *args.fClip,
712 *args.fViewMatrix, *args.fShape, true); 713 *args.fViewMatrix, *args.fShape, true);
713 } 714 }
714 715
715 //////////////////////////////////////////////////////////////////////////////// /////////////////// 716 //////////////////////////////////////////////////////////////////////////////// ///////////////////
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAnalyticRectBatch.cpp ('k') | src/gpu/batches/GrPLSPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698