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

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

Issue 1431433003: Move shader compiling to ProgramBuilder and various ShaderBuilder cleanups. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nits Created 5 years, 1 month 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/GrGLVertexShaderBuilder.h ('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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { 80 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) {
81 const GrPrimitiveProcessor& primProc = fProgramBuilder->primitiveProcessor() ; 81 const GrPrimitiveProcessor& primProc = fProgramBuilder->primitiveProcessor() ;
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
91 GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuin t>* shaderIds) {
92 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString();
93 this->compileAndAppendLayoutQualifiers();
94 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility, &this->uniforms());
95 this->appendDecls(fInputs, &this->inputs());
96 this->appendDecls(fOutputs, &this->outputs());
97 return this->finalize(programId, GR_GL_VERTEX_SHADER, shaderIds);
98 }
99
100 bool GrGLVertexBuilder::addAttribute(const GrShaderVar& var) { 90 bool GrGLVertexBuilder::addAttribute(const GrShaderVar& var) {
101 SkASSERT(GrShaderVar::kAttribute_TypeModifier == var.getTypeModifier()); 91 SkASSERT(GrShaderVar::kAttribute_TypeModifier == var.getTypeModifier());
102 for (int i = 0; i < fInputs.count(); ++i) { 92 for (int i = 0; i < fInputs.count(); ++i) {
103 const GrGLSLShaderVar& attr = fInputs[i]; 93 const GrGLSLShaderVar& attr = fInputs[i];
104 // if attribute already added, don't add it again 94 // if attribute already added, don't add it again
105 if (attr.getName().equals(var.getName())) { 95 if (attr.getName().equals(var.getName())) {
106 return false; 96 return false;
107 } 97 }
108 } 98 }
109 fInputs.push_back(var); 99 fInputs.push_back(var);
110 return true; 100 return true;
111 } 101 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLVertexShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698