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

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

Issue 1438003003: Move all ShaderBuilder files to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@glslProgBuild
Patch Set: nits Created 5 years, 1 month 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/GrGLGeometryProcessor.cpp ('k') | src/gpu/gl/GrGLProgramDesc.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 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 "glsl/GrGLSLProgramBuilder.h"
11 #include "glsl/GrGLSLFragmentShaderBuilder.h"
11 12
12 SkMatrix GrGLPrimitiveProcessor::GetTransformMatrix(const SkMatrix& localMatrix, 13 SkMatrix GrGLPrimitiveProcessor::GetTransformMatrix(const SkMatrix& localMatrix,
13 const GrCoordTransform& coor dTransform) { 14 const GrCoordTransform& coor dTransform) {
14 SkMatrix combined; 15 SkMatrix combined;
15 // We only apply the localmatrix to localcoords 16 // We only apply the localmatrix to localcoords
16 if (kLocal_GrCoordSet == coordTransform.sourceCoords()) { 17 if (kLocal_GrCoordSet == coordTransform.sourceCoords()) {
17 combined.setConcat(coordTransform.getMatrix(), localMatrix); 18 combined.setConcat(coordTransform.getMatrix(), localMatrix);
18 } else { 19 } else {
19 combined = coordTransform.getMatrix(); 20 combined = coordTransform.getMatrix();
20 } 21 }
21 if (coordTransform.reverseY()) { 22 if (coordTransform.reverseY()) {
22 // combined.postScale(1,-1); 23 // combined.postScale(1,-1);
23 // combined.postTranslate(0,1); 24 // combined.postTranslate(0,1);
24 combined.set(SkMatrix::kMSkewY, 25 combined.set(SkMatrix::kMSkewY,
25 combined[SkMatrix::kMPersp0] - combined[SkMatrix::kMSkewY]); 26 combined[SkMatrix::kMPersp0] - combined[SkMatrix::kMSkewY]);
26 combined.set(SkMatrix::kMScaleY, 27 combined.set(SkMatrix::kMScaleY,
27 combined[SkMatrix::kMPersp1] - combined[SkMatrix::kMScaleY]); 28 combined[SkMatrix::kMPersp1] - combined[SkMatrix::kMScaleY]);
28 combined.set(SkMatrix::kMTransY, 29 combined.set(SkMatrix::kMTransY,
29 combined[SkMatrix::kMPersp2] - combined[SkMatrix::kMTransY]); 30 combined[SkMatrix::kMPersp2] - combined[SkMatrix::kMTransY]);
30 } 31 }
31 return combined; 32 return combined;
32 } 33 }
33 34
34 void GrGLPrimitiveProcessor::setupUniformColor(GrGLSLGPBuilder* pb, 35 void GrGLPrimitiveProcessor::setupUniformColor(GrGLSLGPBuilder* pb,
35 const char* outputName, 36 const char* outputName,
36 UniformHandle* colorUniform) { 37 UniformHandle* colorUniform) {
37 GrGLFragmentBuilder* fs = pb->getFragmentShaderBuilder(); 38 GrGLSLFragmentBuilder* fs = pb->getFragmentShaderBuilder();
38 SkASSERT(colorUniform); 39 SkASSERT(colorUniform);
39 const char* stagedLocalVarName; 40 const char* stagedLocalVarName;
40 *colorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility, 41 *colorUniform = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
41 kVec4f_GrSLType, 42 kVec4f_GrSLType,
42 kDefault_GrSLPrecision, 43 kDefault_GrSLPrecision,
43 "Color", 44 "Color",
44 &stagedLocalVarName); 45 &stagedLocalVarName);
45 fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName); 46 fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName);
46 } 47 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGeometryProcessor.cpp ('k') | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698