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

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

Issue 1506113002: Merge fix for 552999 to m47(Always use high precision on NDS transform) (Closed) Base URL: https://skia.googlesource.com/skia.git@m47
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 | « 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 "GrGLVertexShaderBuilder.h" 8 #include "GrGLVertexShaderBuilder.h"
9 #include "GrGLProgramBuilder.h" 9 #include "GrGLProgramBuilder.h"
10 #include "../GrGLGLSL.h" 10 #include "../GrGLGLSL.h"
(...skipping 20 matching lines...) Expand all
31 int vaCount = gp.numAttribs(); 31 int vaCount = gp.numAttribs();
32 for (int i = 0; i < vaCount; i++) { 32 for (int i = 0; i < vaCount; i++) {
33 this->addAttribute(&gp.getAttrib(i)); 33 this->addAttribute(&gp.getAttrib(i));
34 } 34 }
35 return; 35 return;
36 } 36 }
37 37
38 void GrGLVertexBuilder::transformToNormalizedDeviceSpace(const GrShaderVar& posV ar) { 38 void GrGLVertexBuilder::transformToNormalizedDeviceSpace(const GrShaderVar& posV ar) {
39 SkASSERT(!fRtAdjustName); 39 SkASSERT(!fRtAdjustName);
40 40
41 GrSLPrecision precision = kDefault_GrSLPrecision;
42 if (fProgramBuilder->ctxInfo().vendor() == kARM_GrGLVendor) {
43 precision = kHigh_GrSLPrecision;
44 }
45
46 // setup RT Uniform 41 // setup RT Uniform
47 fProgramBuilder->fUniformHandles.fRTAdjustmentUni = 42 fProgramBuilder->fUniformHandles.fRTAdjustmentUni =
48 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility, 43 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility,
49 kVec4f_GrSLType, precision, 44 kVec4f_GrSLType, kHigh_GrSLPrecision,
50 fProgramBuilder->rtAdjustment(), 45 fProgramBuilder->rtAdjustment(),
51 &fRtAdjustName); 46 &fRtAdjustName);
52 if (this->getProgramBuilder()->desc().header().fSnapVerticesToPixelCenters) { 47 if (this->getProgramBuilder()->desc().header().fSnapVerticesToPixelCenters) {
53 if (kVec3f_GrSLType == posVar.getType()) { 48 if (kVec3f_GrSLType == posVar.getType()) {
54 const char* p = posVar.c_str(); 49 const char* p = posVar.c_str();
55 this->codeAppendf("{vec2 _posTmp = vec2(%s.x/%s.z, %s.y/%s.z);", p, p, p, p); 50 this->codeAppendf("{vec2 _posTmp = vec2(%s.x/%s.z, %s.y/%s.z);", p, p, p, p);
56 } else { 51 } else {
57 SkASSERT(kVec2f_GrSLType == posVar.getType()); 52 SkASSERT(kVec2f_GrSLType == posVar.getType());
58 this->codeAppendf("{vec2 _posTmp = %s;", posVar.c_str()); 53 this->codeAppendf("{vec2 _posTmp = %s;", posVar.c_str());
59 } 54 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 for (int i = 0; i < fInputs.count(); ++i) { 97 for (int i = 0; i < fInputs.count(); ++i) {
103 const GrGLShaderVar& attr = fInputs[i]; 98 const GrGLShaderVar& attr = fInputs[i];
104 // if attribute already added, don't add it again 99 // if attribute already added, don't add it again
105 if (attr.getName().equals(var.getName())) { 100 if (attr.getName().equals(var.getName())) {
106 return false; 101 return false;
107 } 102 }
108 } 103 }
109 fInputs.push_back(var); 104 fInputs.push_back(var);
110 return true; 105 return true;
111 } 106 }
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