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

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

Issue 827973002: ViewMatrix uniform upload moved to GeometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@vm-on-gp
Patch Set: feedback inc Created 5 years, 11 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/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrOptDrawState.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 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 "GrGeometryProcessor.h" 8 #include "GrGeometryProcessor.h"
9 9
10 #include "gl/GrGLGeometryProcessor.h" 10 #include "gl/GrGLGeometryProcessor.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 &stagedLocalVarName); 49 &stagedLocalVarName);
50 fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName); 50 fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName);
51 } else if (kAttribute_GrGPInput == inputType) { 51 } else if (kAttribute_GrGPInput == inputType) {
52 SkASSERT(colorAttr); 52 SkASSERT(colorAttr);
53 pb->addPassThroughAttribute(colorAttr, outputName); 53 pb->addPassThroughAttribute(colorAttr, outputName);
54 } else if (kAllOnes_GrGPInput == inputType) { 54 } else if (kAllOnes_GrGPInput == inputType) {
55 fs->codeAppendf("%s = vec4(1);", outputName); 55 fs->codeAppendf("%s = vec4(1);", outputName);
56 } 56 }
57 } 57 }
58 58
59 void GrGLGeometryProcessor::addUniformViewMatrix(GrGLGPBuilder* pb) {
60 fViewMatrixUniform = pb->addUniform(GrGLProgramBuilder::kVertex_Visibility,
61 kMat33f_GrSLType, kDefault_GrSLPrecision ,
62 "uViewM",
63 &fViewMatrixName);
64 }
65
66 void GrGLGeometryProcessor::setUniformViewMatrix(const GrGLProgramDataManager& p dman,
67 const SkMatrix& viewMatrix) {
68 if (!fViewMatrix.cheapEqualTo(viewMatrix)) {
69 SkASSERT(fViewMatrixUniform.isValid());
70 fViewMatrix = viewMatrix;
71
72 GrGLfloat viewMatrix[3 * 3];
73 GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
74 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
75 }
76 }
77
59 //////////////////////////////////////////////////////////////////////////////// /////////////////// 78 //////////////////////////////////////////////////////////////////////////////// ///////////////////
60 79
61 struct PathBatchTracker { 80 struct PathBatchTracker {
62 GrGPInput fInputColorType; 81 GrGPInput fInputColorType;
63 GrGPInput fInputCoverageType; 82 GrGPInput fInputCoverageType;
64 GrColor fColor; 83 GrColor fColor;
65 bool fUsesLocalCoords; 84 bool fUsesLocalCoords;
66 }; 85 };
67 86
68 class GrGLPathProcessor : public GrGLGeometryProcessor { 87 class GrGLPathProcessor : public GrGLGeometryProcessor {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 192
174 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt, 193 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt,
175 const GrGLCaps& caps, 194 const GrGLCaps& caps,
176 GrProcessorKeyBuilder* b) const { 195 GrProcessorKeyBuilder* b) const {
177 GrGLPathProcessor::GenKey(*this, bt, caps, b); 196 GrGLPathProcessor::GenKey(*this, bt, caps, b);
178 } 197 }
179 198
180 GrGLGeometryProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& b t) const { 199 GrGLGeometryProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& b t) const {
181 return SkNEW_ARGS(GrGLPathProcessor, (*this, bt)); 200 return SkNEW_ARGS(GrGLPathProcessor, (*this, bt));
182 } 201 }
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrOptDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698