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

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

Issue 861553008: Add perspective divide when we're mapping down to a 2D varying (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | 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 "GrGeometryProcessor.h" 8 #include "GrGeometryProcessor.h"
9 9
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCoords , 211 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCoords ,
212 (SkString(v.fsIn()), varyingType)); 212 (SkString(v.fsIn()), varyingType));
213 213
214 // varying = matrix * coords (logically) 214 // varying = matrix * coords (logically)
215 if (kDevice_GrCoordSet == coordType) { 215 if (kDevice_GrCoordSet == coordType) {
216 if (kVec2f_GrSLType == varyingType) { 216 if (kVec2f_GrSLType == varyingType) {
217 if (kVec2f_GrSLType == posVar.getType()) { 217 if (kVec2f_GrSLType == posVar.getType()) {
218 vb->codeAppendf("%s = (%s * vec3(%s, 1)).xy;", 218 vb->codeAppendf("%s = (%s * vec3(%s, 1)).xy;",
219 v.vsOut(), uniName, posVar.c_str()); 219 v.vsOut(), uniName, posVar.c_str());
220 } else { 220 } else {
221 vb->codeAppendf("%s = (%s * %s).xy;", v.vsOut(), uniName , posVar.c_str()); 221 // The brackets here are just to scope the temp variable
222 vb->codeAppendf("{ vec3 temp = %s * %s;", uniName, posVa r.c_str());
223 vb->codeAppendf("%s = vec2(temp.x/temp.z, temp.y/temp.z) ; }", v.vsOut());
222 } 224 }
223 } else { 225 } else {
224 if (kVec2f_GrSLType == posVar.getType()) { 226 if (kVec2f_GrSLType == posVar.getType()) {
225 vb->codeAppendf("%s = %s * vec3(%s, 1);", 227 vb->codeAppendf("%s = %s * vec3(%s, 1);",
226 v.vsOut(), uniName, posVar.c_str()); 228 v.vsOut(), uniName, posVar.c_str());
227 } else { 229 } else {
228 vb->codeAppendf("%s = %s * %s;", v.vsOut(), uniName, pos Var.c_str()); 230 vb->codeAppendf("%s = %s * %s;", v.vsOut(), uniName, pos Var.c_str());
229 } 231 }
230 } 232 }
231 } else { 233 } else {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 const GrGLCaps& caps) const { 562 const GrGLCaps& caps) const {
561 SkASSERT(caps.nvprSupport() != GrGLCaps::kNone_NvprSupport); 563 SkASSERT(caps.nvprSupport() != GrGLCaps::kNone_NvprSupport);
562 if (caps.nvprSupport() == GrGLCaps::kLegacy_NvprSupport) { 564 if (caps.nvprSupport() == GrGLCaps::kLegacy_NvprSupport) {
563 return SkNEW_ARGS(GrGLLegacyPathProcessor, (*this, bt, 565 return SkNEW_ARGS(GrGLLegacyPathProcessor, (*this, bt,
564 caps.maxFixedFunctionTexture Coords())); 566 caps.maxFixedFunctionTexture Coords()));
565 } else { 567 } else {
566 return SkNEW_ARGS(GrGLNormalPathProcessor, (*this, bt)); 568 return SkNEW_ARGS(GrGLNormalPathProcessor, (*this, bt));
567 } 569 }
568 } 570 }
569 571
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698