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

Side by Side Diff: src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp

Issue 1352883002: Fix Ganesh perspective projection bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixed overlength line Created 5 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/gl/GrGLProgram.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 "GrGLVertexShaderBuilder.h" 8 #include "GrGLVertexShaderBuilder.h"
9 #include "GrGLProgramBuilder.h" 9 #include "GrGLProgramBuilder.h"
10 #include "../GrGLGLSL.h" 10 #include "../GrGLGLSL.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 &fRtAdjustName); 51 &fRtAdjustName);
52 if (this->getProgramBuilder()->desc().header().fSnapVerticesToPixelCenters) { 52 if (this->getProgramBuilder()->desc().header().fSnapVerticesToPixelCenters) {
53 if (kVec3f_GrSLType == posVar.getType()) { 53 if (kVec3f_GrSLType == posVar.getType()) {
54 const char* p = posVar.c_str(); 54 const char* p = posVar.c_str();
55 this->codeAppendf("{vec2 _posTmp = vec2(%s.x/%s.z, %s.y/%s.z);", p, p, p, p); 55 this->codeAppendf("{vec2 _posTmp = vec2(%s.x/%s.z, %s.y/%s.z);", p, p, p, p);
56 } else { 56 } else {
57 SkASSERT(kVec2f_GrSLType == posVar.getType()); 57 SkASSERT(kVec2f_GrSLType == posVar.getType());
58 this->codeAppendf("{vec2 _posTmp = %s;", posVar.c_str()); 58 this->codeAppendf("{vec2 _posTmp = %s;", posVar.c_str());
59 } 59 }
60 this->codeAppendf("_posTmp = floor(_posTmp) + vec2(0.5, 0.5);" 60 this->codeAppendf("_posTmp = floor(_posTmp) + vec2(0.5, 0.5);"
61 "gl_Position = vec4(_posTmp.x * %s.x + %s.y, _posTmp.y * %s.z + %s.w, 0, 1);}", 61 "gl_Position = vec4(_posTmp.x * %s.x + %s.y,"
62 "_posTmp.y * %s.z + %s.w, 0, 1);}",
62 fRtAdjustName, fRtAdjustName, fRtAdjustName, fRtAdjust Name); 63 fRtAdjustName, fRtAdjustName, fRtAdjustName, fRtAdjust Name);
63 } else if (kVec3f_GrSLType == posVar.getType()) { 64 } else if (kVec3f_GrSLType == posVar.getType()) {
64 this->codeAppendf("gl_Position = vec4(dot(%s.xz, %s.xy)/%s.z, dot(%s.yz, %s.zw)/%s.z, 0, 1);", 65 this->codeAppendf("gl_Position = vec4(dot(%s.xz, %s.xy), dot(%s.yz, %s.z w), 0, %s.z);",
65 posVar.c_str(), fRtAdjustName, posVar.c_str(), 66 posVar.c_str(), fRtAdjustName,
66 posVar.c_str(), fRtAdjustName, posVar.c_str()); 67 posVar.c_str(), fRtAdjustName,
68 posVar.c_str());
67 } else { 69 } else {
68 SkASSERT(kVec2f_GrSLType == posVar.getType()); 70 SkASSERT(kVec2f_GrSLType == posVar.getType());
69 this->codeAppendf("gl_Position = vec4(%s.x * %s.x + %s.y, %s.y * %s.z + %s.w, 0, 1);", 71 this->codeAppendf("gl_Position = vec4(%s.x * %s.x + %s.y, %s.y * %s.z + %s.w, 0, 1);",
70 posVar.c_str(), fRtAdjustName, fRtAdjustName, 72 posVar.c_str(), fRtAdjustName, fRtAdjustName,
71 posVar.c_str(), fRtAdjustName, fRtAdjustName); 73 posVar.c_str(), fRtAdjustName, fRtAdjustName);
72 } 74 }
73 // We could have the GrGeometryProcessor do this, but its just easier to hav e it performed 75 // We could have the GrGeometryProcessor do this, but its just easier to hav e it performed
74 // here. If we ever need to set variable pointsize, then we can reinvestigat e 76 // here. If we ever need to set variable pointsize, then we can reinvestigat e
75 this->codeAppend("gl_PointSize = 1.0;"); 77 this->codeAppend("gl_PointSize = 1.0;");
76 } 78 }
(...skipping 23 matching lines...) Expand all
100 for (int i = 0; i < fInputs.count(); ++i) { 102 for (int i = 0; i < fInputs.count(); ++i) {
101 const GrGLShaderVar& attr = fInputs[i]; 103 const GrGLShaderVar& attr = fInputs[i];
102 // if attribute already added, don't add it again 104 // if attribute already added, don't add it again
103 if (attr.getName().equals(var.getName())) { 105 if (attr.getName().equals(var.getName())) {
104 return false; 106 return false;
105 } 107 }
106 } 108 }
107 fInputs.push_back(var); 109 fInputs.push_back(var);
108 return true; 110 return true;
109 } 111 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698