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

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

Issue 890433003: Revert of Add device space "nudge" to gpu draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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/effects/GrConvexPolyEffect.cpp ('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 "GrGLShaderStringBuilder.h" 10 #include "GrGLShaderStringBuilder.h"
(...skipping 29 matching lines...) Expand all
40 // setup RT Uniform 40 // setup RT Uniform
41 fProgramBuilder->fUniformHandles.fRTAdjustmentUni = 41 fProgramBuilder->fUniformHandles.fRTAdjustmentUni =
42 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility, 42 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility,
43 kVec4f_GrSLType, kDefault_GrSLPrecision, 43 kVec4f_GrSLType, kDefault_GrSLPrecision,
44 fProgramBuilder->rtAdjustment(), 44 fProgramBuilder->rtAdjustment(),
45 &fRtAdjustName); 45 &fRtAdjustName);
46 46
47 // Transform from Skia's device coords to GL's normalized device coords. Not e that 47 // Transform from Skia's device coords to GL's normalized device coords. Not e that
48 // because we want to "nudge" the device space positions we are converting t o 48 // because we want to "nudge" the device space positions we are converting t o
49 // non-homogeneous NDC. 49 // non-homogeneous NDC.
50 // The "0.05" nudge serves to match the raster path's rounding for bw draws.
51 // For aa draws we just assume the impact will be minimal - so we always per form the nudge.
52 if (kVec3f_GrSLType == posVar.getType()) { 50 if (kVec3f_GrSLType == posVar.getType()) {
53 this->codeAppendf("gl_Position = vec4((dot(%s.xz, %s.xy)/%s.z) + 0.05 * %s.x, (dot(%s.yz, %s.zw)/%s.z) + 0.05 * %s.z, 0, 1);", 51 this->codeAppendf("gl_Position = vec4(dot(%s.xz, %s.xy)/%s.z, dot(%s.yz, %s.zw)/%s.z, 0, 1);",
54 posVar.c_str(), fRtAdjustName, posVar.c_str(), fRtAdju stName, 52 posVar.c_str(), fRtAdjustName, posVar.c_str(),
55 posVar.c_str(), fRtAdjustName, posVar.c_str(), fRtAdju stName); 53 posVar.c_str(), fRtAdjustName, posVar.c_str());
56 } else { 54 } else {
57 SkASSERT(kVec2f_GrSLType == posVar.getType()); 55 SkASSERT(kVec2f_GrSLType == posVar.getType());
58 this->codeAppendf("gl_Position = vec4((%s.x + 0.05) * %s.x + %s.y, (%s.y + 0.05) * %s.z + %s.w, 0, 1);", 56 this->codeAppendf("gl_Position = vec4(%s.x * %s.x + %s.y, %s.y * %s.z + %s.w, 0, 1);",
59 posVar.c_str(), fRtAdjustName, fRtAdjustName, 57 posVar.c_str(), fRtAdjustName, fRtAdjustName,
60 posVar.c_str(), fRtAdjustName, fRtAdjustName); 58 posVar.c_str(), fRtAdjustName, fRtAdjustName);
61 } 59 }
62 60
63 // We could have the GrGeometryProcessor do this, but its just easier to hav e it performed here. 61 // We could have the GrGeometryProcessor do this, but its just easier to hav e it performed here.
64 // If we ever need to set variable pointsize, then we can reinvestigate 62 // If we ever need to set variable pointsize, then we can reinvestigate
65 this->codeAppend("gl_PointSize = 1.0;"); 63 this->codeAppend("gl_PointSize = 1.0;");
66 } 64 }
67 65
68 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { 66 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 for (int i = 0; i < fInputs.count(); ++i) { 100 for (int i = 0; i < fInputs.count(); ++i) {
103 const GrGLShaderVar& attr = fInputs[i]; 101 const GrGLShaderVar& attr = fInputs[i];
104 // if attribute already added, don't add it again 102 // if attribute already added, don't add it again
105 if (attr.getName().equals(var.getName())) { 103 if (attr.getName().equals(var.getName())) {
106 return false; 104 return false;
107 } 105 }
108 } 106 }
109 fInputs.push_back(var); 107 fInputs.push_back(var);
110 return true; 108 return true;
111 } 109 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698