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 "GrGLShaderStringBuilder.h" | 10 #include "GrGLShaderStringBuilder.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const GrGeometryProcessor::VertexAttribArray& v = gp->getAttribs(); | 78 const GrGeometryProcessor::VertexAttribArray& v = gp->getAttribs(); |
79 int vaCount = v.count(); | 79 int vaCount = v.count(); |
80 for (int i = 0; i < vaCount; i++) { | 80 for (int i = 0; i < vaCount; i++) { |
81 GL_CALL(BindAttribLocation(programID, i, v[i].fName)); | 81 GL_CALL(BindAttribLocation(programID, i, v[i].fName)); |
82 } | 82 } |
83 return; | 83 return; |
84 } | 84 } |
85 | 85 |
86 bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, | 86 bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, |
87 SkTDArray<GrGLuint>* shaderIds) const { | 87 SkTDArray<GrGLuint>* shaderIds) const { |
88 GrGpuGL* gpu = fProgramBuilder->gpu(); | 88 GrGLGpu* gpu = fProgramBuilder->gpu(); |
89 const GrGLContext& glCtx = gpu->glContext(); | 89 const GrGLContext& glCtx = gpu->glContext(); |
90 const GrGLContextInfo& ctxInfo = gpu->ctxInfo(); | 90 const GrGLContextInfo& ctxInfo = gpu->ctxInfo(); |
91 SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo)); | 91 SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo)); |
92 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility,
&vertShaderSrc); | 92 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility,
&vertShaderSrc); |
93 this->appendDecls(fInputs, &vertShaderSrc); | 93 this->appendDecls(fInputs, &vertShaderSrc); |
94 this->appendDecls(fOutputs, &vertShaderSrc); | 94 this->appendDecls(fOutputs, &vertShaderSrc); |
95 vertShaderSrc.append("void main() {"); | 95 vertShaderSrc.append("void main() {"); |
96 vertShaderSrc.append(fCode); | 96 vertShaderSrc.append(fCode); |
97 vertShaderSrc.append("}\n"); | 97 vertShaderSrc.append("}\n"); |
98 GrGLuint vertShaderId = GrGLCompileAndAttachShader(glCtx, programId, | 98 GrGLuint vertShaderId = GrGLCompileAndAttachShader(glCtx, programId, |
(...skipping 11 matching lines...) Expand all Loading... |
110 for (int i = 0; i < fInputs.count(); ++i) { | 110 for (int i = 0; i < fInputs.count(); ++i) { |
111 const GrGLShaderVar& attr = fInputs[i]; | 111 const GrGLShaderVar& attr = fInputs[i]; |
112 // if attribute already added, don't add it again | 112 // if attribute already added, don't add it again |
113 if (attr.getName().equals(var.getName())) { | 113 if (attr.getName().equals(var.getName())) { |
114 return false; | 114 return false; |
115 } | 115 } |
116 } | 116 } |
117 fInputs.push_back(var); | 117 fInputs.push_back(var); |
118 return true; | 118 return true; |
119 } | 119 } |
OLD | NEW |