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

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

Issue 1420033002: Revert of Add version string and force highp NDS transfrom to GLSLCaps (Closed) Base URL: https://skia.googlesource.com/skia.git@renameShaderVar
Patch Set: Created 5 years, 2 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/builders/GrGLFragmentShaderBuilder.cpp ('k') | src/gpu/glsl/GrGLSLCaps.h » ('j') | 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 21 matching lines...) Expand all
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; 41 GrSLPrecision precision = kDefault_GrSLPrecision;
42 if (fProgramBuilder->glslCaps()->forceHighPrecisionNDSTransform()) { 42 if (fProgramBuilder->ctxInfo().vendor() == kARM_GrGLVendor) {
43 precision = kHigh_GrSLPrecision; 43 precision = kHigh_GrSLPrecision;
44 } 44 }
45 45
46 // setup RT Uniform 46 // setup RT Uniform
47 fProgramBuilder->fUniformHandles.fRTAdjustmentUni = 47 fProgramBuilder->fUniformHandles.fRTAdjustmentUni =
48 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility, 48 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility,
49 kVec4f_GrSLType, precision, 49 kVec4f_GrSLType, precision,
50 fProgramBuilder->rtAdjustment(), 50 fProgramBuilder->rtAdjustment(),
51 &fRtAdjustName); 51 &fRtAdjustName);
52 if (this->getProgramBuilder()->desc().header().fSnapVerticesToPixelCenters) { 52 if (this->getProgramBuilder()->desc().header().fSnapVerticesToPixelCenters) {
(...skipping 29 matching lines...) Expand all
82 82
83 int vaCount = primProc.numAttribs(); 83 int vaCount = primProc.numAttribs();
84 for (int i = 0; i < vaCount; i++) { 84 for (int i = 0; i < vaCount; i++) {
85 GL_CALL(BindAttribLocation(programID, i, primProc.getAttrib(i).fName)); 85 GL_CALL(BindAttribLocation(programID, i, primProc.getAttrib(i).fName));
86 } 86 }
87 return; 87 return;
88 } 88 }
89 89
90 bool 90 bool
91 GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuin t>* shaderIds) { 91 GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuin t>* shaderIds) {
92 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); 92 this->versionDecl() = GrGLGetGLSLVersionDecl(fProgramBuilder->ctxInfo());
93 this->compileAndAppendLayoutQualifiers(); 93 this->compileAndAppendLayoutQualifiers();
94 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility, &this->uniforms()); 94 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility, &this->uniforms());
95 this->appendDecls(fInputs, &this->inputs()); 95 this->appendDecls(fInputs, &this->inputs());
96 this->appendDecls(fOutputs, &this->outputs()); 96 this->appendDecls(fOutputs, &this->outputs());
97 return this->finalize(programId, GR_GL_VERTEX_SHADER, shaderIds); 97 return this->finalize(programId, GR_GL_VERTEX_SHADER, shaderIds);
98 } 98 }
99 99
100 bool GrGLVertexBuilder::addAttribute(const GrShaderVar& var) { 100 bool GrGLVertexBuilder::addAttribute(const GrShaderVar& var) {
101 SkASSERT(GrShaderVar::kAttribute_TypeModifier == var.getTypeModifier()); 101 SkASSERT(GrShaderVar::kAttribute_TypeModifier == var.getTypeModifier());
102 for (int i = 0; i < fInputs.count(); ++i) { 102 for (int i = 0; i < fInputs.count(); ++i) {
103 const GrGLSLShaderVar& attr = fInputs[i]; 103 const GrGLSLShaderVar& attr = fInputs[i];
104 // if attribute already added, don't add it again 104 // if attribute already added, don't add it again
105 if (attr.getName().equals(var.getName())) { 105 if (attr.getName().equals(var.getName())) {
106 return false; 106 return false;
107 } 107 }
108 } 108 }
109 fInputs.push_back(var); 109 fInputs.push_back(var);
110 return true; 110 return true;
111 } 111 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp ('k') | src/gpu/glsl/GrGLSLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698