| OLD | NEW |
| 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 "../GrGLGpu.h" | 10 #include "../GrGLGpu.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 int vaCount = primProc.numAttribs(); | 74 int vaCount = primProc.numAttribs(); |
| 75 for (int i = 0; i < vaCount; i++) { | 75 for (int i = 0; i < vaCount; i++) { |
| 76 GL_CALL(BindAttribLocation(programID, i, primProc.getAttrib(i).fName)); | 76 GL_CALL(BindAttribLocation(programID, i, primProc.getAttrib(i).fName)); |
| 77 } | 77 } |
| 78 return; | 78 return; |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool | 81 bool |
| 82 GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuin
t>* shaderIds) { | 82 GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuin
t>* shaderIds) { |
| 83 this->versionDecl() = GrGetGLSLVersionDecl(fProgramBuilder->ctxInfo()); | 83 this->versionDecl() = GrGetGLSLVersionDecl(fProgramBuilder->ctxInfo()); |
| 84 this->compileAndAppendLayoutQualifiers(); |
| 84 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility,
&this->uniforms()); | 85 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility,
&this->uniforms()); |
| 85 this->appendDecls(fInputs, &this->inputs()); | 86 this->appendDecls(fInputs, &this->inputs()); |
| 86 this->appendDecls(fOutputs, &this->outputs()); | 87 this->appendDecls(fOutputs, &this->outputs()); |
| 87 return this->finalize(programId, GR_GL_VERTEX_SHADER, shaderIds); | 88 return this->finalize(programId, GR_GL_VERTEX_SHADER, shaderIds); |
| 88 } | 89 } |
| 89 | 90 |
| 90 bool GrGLVertexBuilder::addAttribute(const GrShaderVar& var) { | 91 bool GrGLVertexBuilder::addAttribute(const GrShaderVar& var) { |
| 91 SkASSERT(GrShaderVar::kAttribute_TypeModifier == var.getTypeModifier()); | 92 SkASSERT(GrShaderVar::kAttribute_TypeModifier == var.getTypeModifier()); |
| 92 for (int i = 0; i < fInputs.count(); ++i) { | 93 for (int i = 0; i < fInputs.count(); ++i) { |
| 93 const GrGLShaderVar& attr = fInputs[i]; | 94 const GrGLShaderVar& attr = fInputs[i]; |
| 94 // if attribute already added, don't add it again | 95 // if attribute already added, don't add it again |
| 95 if (attr.getName().equals(var.getName())) { | 96 if (attr.getName().equals(var.getName())) { |
| 96 return false; | 97 return false; |
| 97 } | 98 } |
| 98 } | 99 } |
| 99 fInputs.push_back(var); | 100 fInputs.push_back(var); |
| 100 return true; | 101 return true; |
| 101 } | 102 } |
| OLD | NEW |