| 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 "../GrGLGLSL.h" | 10 #include "../GrGLGLSL.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |