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

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

Issue 894013002: patch from issue 886233004 at patchset 40001 (http://crrev.com/886233004#ps40001) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 10 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/GrGLShaderStringBuilder.cpp ('k') | tools/bench_pictures_main.cpp » ('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 "GrGLShaderStringBuilder.h" 10 #include "GrGLShaderStringBuilder.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 GrGLGpu* gpu = fProgramBuilder->gpu(); 78 GrGLGpu* gpu = fProgramBuilder->gpu();
79 const GrGLContext& glCtx = gpu->glContext(); 79 const GrGLContext& glCtx = gpu->glContext();
80 const GrGLContextInfo& ctxInfo = gpu->ctxInfo(); 80 const GrGLContextInfo& ctxInfo = gpu->ctxInfo();
81 SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo)); 81 SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo));
82 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility, &vertShaderSrc); 82 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility, &vertShaderSrc);
83 this->appendDecls(fInputs, &vertShaderSrc); 83 this->appendDecls(fInputs, &vertShaderSrc);
84 this->appendDecls(fOutputs, &vertShaderSrc); 84 this->appendDecls(fOutputs, &vertShaderSrc);
85 vertShaderSrc.append("void main() {"); 85 vertShaderSrc.append("void main() {");
86 vertShaderSrc.append(fCode); 86 vertShaderSrc.append(fCode);
87 vertShaderSrc.append("}\n"); 87 vertShaderSrc.append("}\n");
88 GrGLuint vertShaderId = GrGLCompileAndAttachShader(glCtx, programId, 88 GrGLuint vertShaderId = GrGLCompileAndAttachShader(glCtx, programId, GR_GL_V ERTEX_SHADER,
89 GR_GL_VERTEX_SHADER, vert ShaderSrc, 89 vertShaderSrc, gpu->stats ());
90 gpu->gpuStats());
91 if (!vertShaderId) { 90 if (!vertShaderId) {
92 return false; 91 return false;
93 } 92 }
94 *shaderIds->append() = vertShaderId; 93 *shaderIds->append() = vertShaderId;
95 return true; 94 return true;
96 } 95 }
97 96
98 bool GrGLVertexBuilder::addAttribute(const GrShaderVar& var) { 97 bool GrGLVertexBuilder::addAttribute(const GrShaderVar& var) {
99 SkASSERT(GrShaderVar::kAttribute_TypeModifier == var.getTypeModifier()); 98 SkASSERT(GrShaderVar::kAttribute_TypeModifier == var.getTypeModifier());
100 for (int i = 0; i < fInputs.count(); ++i) { 99 for (int i = 0; i < fInputs.count(); ++i) {
101 const GrGLShaderVar& attr = fInputs[i]; 100 const GrGLShaderVar& attr = fInputs[i];
102 // if attribute already added, don't add it again 101 // if attribute already added, don't add it again
103 if (attr.getName().equals(var.getName())) { 102 if (attr.getName().equals(var.getName())) {
104 return false; 103 return false;
105 } 104 }
106 } 105 }
107 fInputs.push_back(var); 106 fInputs.push_back(var);
108 return true; 107 return true;
109 } 108 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLShaderStringBuilder.cpp ('k') | tools/bench_pictures_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698