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

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

Issue 1132323003: Revert of Preliminary attempt to remove batch tracker (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup5
Patch Set: Created 5 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
« no previous file with comments | « src/gpu/gl/GrGLPrimitiveProcessor.h ('k') | no next file » | 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 "GrGLPrimitiveProcessor.h" 8 #include "GrGLPrimitiveProcessor.h"
9 9
10 #include "builders/GrGLProgramBuilder.h" 10 #include "builders/GrGLProgramBuilder.h"
(...skipping 13 matching lines...) Expand all
24 combined.set(SkMatrix::kMSkewY, 24 combined.set(SkMatrix::kMSkewY,
25 combined[SkMatrix::kMPersp0] - combined[SkMatrix::kMSkewY]); 25 combined[SkMatrix::kMPersp0] - combined[SkMatrix::kMSkewY]);
26 combined.set(SkMatrix::kMScaleY, 26 combined.set(SkMatrix::kMScaleY,
27 combined[SkMatrix::kMPersp1] - combined[SkMatrix::kMScaleY]); 27 combined[SkMatrix::kMPersp1] - combined[SkMatrix::kMScaleY]);
28 combined.set(SkMatrix::kMTransY, 28 combined.set(SkMatrix::kMTransY,
29 combined[SkMatrix::kMPersp2] - combined[SkMatrix::kMTransY]); 29 combined[SkMatrix::kMPersp2] - combined[SkMatrix::kMTransY]);
30 } 30 }
31 return combined; 31 return combined;
32 } 32 }
33 33
34 void GrGLPrimitiveProcessor::setupUniformColor(GrGLGPBuilder* pb, 34 void
35 const char* outputName, 35 GrGLPrimitiveProcessor::setupColorPassThrough(GrGLGPBuilder* pb,
36 UniformHandle* colorUniform) { 36 GrGPInput inputType,
37 const char* outputName,
38 const GrGeometryProcessor::Attribu te* colorAttr,
39 UniformHandle* colorUniform) {
37 GrGLFragmentBuilder* fs = pb->getFragmentShaderBuilder(); 40 GrGLFragmentBuilder* fs = pb->getFragmentShaderBuilder();
38 SkASSERT(colorUniform); 41 if (kUniform_GrGPInput == inputType) {
39 const char* stagedLocalVarName; 42 SkASSERT(colorUniform);
40 *colorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility, 43 const char* stagedLocalVarName;
41 kVec4f_GrSLType, 44 *colorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
42 kDefault_GrSLPrecision, 45 kVec4f_GrSLType,
43 "Color", 46 kDefault_GrSLPrecision,
44 &stagedLocalVarName); 47 "Color",
45 fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName); 48 &stagedLocalVarName);
49 fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName);
50 } else if (kAttribute_GrGPInput == inputType) {
51 SkASSERT(colorAttr);
52 pb->addPassThroughAttribute(colorAttr, outputName);
53 } else if (kAllOnes_GrGPInput == inputType) {
54 fs->codeAppendf("%s = vec4(1);", outputName);
55 }
46 } 56 }
47 57
48 void GrGLPrimitiveProcessor::addUniformViewMatrix(GrGLGPBuilder* pb) { 58 void GrGLPrimitiveProcessor::addUniformViewMatrix(GrGLGPBuilder* pb) {
49 fViewMatrixUniform = pb->addUniform(GrGLProgramBuilder::kVertex_Visibility, 59 fViewMatrixUniform = pb->addUniform(GrGLProgramBuilder::kVertex_Visibility,
50 kMat33f_GrSLType, kDefault_GrSLPrecision , 60 kMat33f_GrSLType, kDefault_GrSLPrecision ,
51 "uViewM", 61 "uViewM",
52 &fViewMatrixName); 62 &fViewMatrixName);
53 } 63 }
54 64
55 void GrGLPrimitiveProcessor::setUniformViewMatrix(const GrGLProgramDataManager& pdman, 65 void GrGLPrimitiveProcessor::setUniformViewMatrix(const GrGLProgramDataManager& pdman,
56 const SkMatrix& viewMatrix) { 66 const SkMatrix& viewMatrix) {
57 if (!viewMatrix.isIdentity() && !fViewMatrix.cheapEqualTo(viewMatrix)) { 67 if (!viewMatrix.isIdentity() && !fViewMatrix.cheapEqualTo(viewMatrix)) {
58 SkASSERT(fViewMatrixUniform.isValid()); 68 SkASSERT(fViewMatrixUniform.isValid());
59 fViewMatrix = viewMatrix; 69 fViewMatrix = viewMatrix;
60 70
61 GrGLfloat viewMatrix[3 * 3]; 71 GrGLfloat viewMatrix[3 * 3];
62 GrGLGetMatrix<3>(viewMatrix, fViewMatrix); 72 GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
63 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); 73 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
64 } 74 }
65 } 75 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLPrimitiveProcessor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698