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

Side by Side Diff: src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp

Issue 1507603004: Merge fix for 552999 to m48(Always use high precision on NDS transform) (Closed) Base URL: https://skia.googlesource.com/skia.git@m48
Patch Set: Created 5 years 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/glsl/GrGLSLCaps.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 "GrGLSLVertexShaderBuilder.h" 8 #include "GrGLSLVertexShaderBuilder.h"
9 #include "glsl/GrGLSLProgramBuilder.h" 9 #include "glsl/GrGLSLProgramBuilder.h"
10 10
(...skipping 15 matching lines...) Expand all
26 int vaCount = gp.numAttribs(); 26 int vaCount = gp.numAttribs();
27 for (int i = 0; i < vaCount; i++) { 27 for (int i = 0; i < vaCount; i++) {
28 this->addAttribute(&gp.getAttrib(i)); 28 this->addAttribute(&gp.getAttrib(i));
29 } 29 }
30 return; 30 return;
31 } 31 }
32 32
33 void GrGLSLVertexBuilder::transformToNormalizedDeviceSpace(const GrShaderVar& po sVar) { 33 void GrGLSLVertexBuilder::transformToNormalizedDeviceSpace(const GrShaderVar& po sVar) {
34 SkASSERT(!fRtAdjustName); 34 SkASSERT(!fRtAdjustName);
35 35
36 GrSLPrecision precision = kDefault_GrSLPrecision;
37 if (fProgramBuilder->glslCaps()->forceHighPrecisionNDSTransform()) {
38 precision = kHigh_GrSLPrecision;
39 }
40
41 // setup RT Uniform 36 // setup RT Uniform
42 fProgramBuilder->fUniformHandles.fRTAdjustmentUni = 37 fProgramBuilder->fUniformHandles.fRTAdjustmentUni =
43 fProgramBuilder->addUniform(GrGLSLProgramBuilder::kVertex_Visibility , 38 fProgramBuilder->addUniform(GrGLSLProgramBuilder::kVertex_Visibility ,
44 kVec4f_GrSLType, precision, 39 kVec4f_GrSLType, kHigh_GrSLPrecision,
45 fProgramBuilder->rtAdjustment(), 40 fProgramBuilder->rtAdjustment(),
46 &fRtAdjustName); 41 &fRtAdjustName);
47 if (this->getProgramBuilder()->desc().header().fSnapVerticesToPixelCenters) { 42 if (this->getProgramBuilder()->desc().header().fSnapVerticesToPixelCenters) {
48 if (kVec3f_GrSLType == posVar.getType()) { 43 if (kVec3f_GrSLType == posVar.getType()) {
49 const char* p = posVar.c_str(); 44 const char* p = posVar.c_str();
50 this->codeAppendf("{vec2 _posTmp = vec2(%s.x/%s.z, %s.y/%s.z);", p, p, p, p); 45 this->codeAppendf("{vec2 _posTmp = vec2(%s.x/%s.z, %s.y/%s.z);", p, p, p, p);
51 } else { 46 } else {
52 SkASSERT(kVec2f_GrSLType == posVar.getType()); 47 SkASSERT(kVec2f_GrSLType == posVar.getType());
53 this->codeAppendf("{vec2 _posTmp = %s;", posVar.c_str()); 48 this->codeAppendf("{vec2 _posTmp = %s;", posVar.c_str());
54 } 49 }
(...skipping 23 matching lines...) Expand all
78 const GrGLSLShaderVar& attr = fInputs[i]; 73 const GrGLSLShaderVar& attr = fInputs[i];
79 // if attribute already added, don't add it again 74 // if attribute already added, don't add it again
80 if (attr.getName().equals(var.getName())) { 75 if (attr.getName().equals(var.getName())) {
81 return false; 76 return false;
82 } 77 }
83 } 78 }
84 fInputs.push_back(var); 79 fInputs.push_back(var);
85 return true; 80 return true;
86 } 81 }
87 82
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLCaps.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698