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

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

Issue 582963002: Solo gp (Closed) Base URL: https://skia.googlesource.com/skia.git@no_peb
Patch Set: rebase Created 6 years, 2 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/GrGLVertexShaderBuilder.h ('k') | tests/GLProgramsTest.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 "GrGLFullProgramBuilder.h" 9 #include "GrGLFullProgramBuilder.h"
10 #include "GrGLShaderStringBuilder.h" 10 #include "GrGLShaderStringBuilder.h"
(...skipping 19 matching lines...) Expand all
30 const GrGLShaderVar& attr = fInputs[i]; 30 const GrGLShaderVar& attr = fInputs[i];
31 // if attribute already added, don't add it again 31 // if attribute already added, don't add it again
32 if (attr.getName().equals(var.getName())) { 32 if (attr.getName().equals(var.getName())) {
33 return false; 33 return false;
34 } 34 }
35 } 35 }
36 fInputs.push_back(var); 36 fInputs.push_back(var);
37 return true; 37 return true;
38 } 38 }
39 39
40 void GrGLVertexShaderBuilder::emitAttributes(const GrEffectStage& stage) { 40 void GrGLVertexShaderBuilder::emitAttributes(const GrGeometryProcessor& gp) {
41 const GrEffect& effect = *stage.getEffect(); 41 const GrGeometryProcessor::VertexAttribArray& vars = gp.getVertexAttribs();
42 const GrEffect::VertexAttribArray& vars =
43 effect.getVertexAttribs();
44 int numAttributes = vars.count(); 42 int numAttributes = vars.count();
45 for (int a = 0; a < numAttributes; ++a) { 43 for (int a = 0; a < numAttributes; ++a) {
46 this->addAttribute(vars[a]); 44 this->addAttribute(vars[a]);
47 } 45 }
48 } 46 }
49 47
50 void GrGLVertexShaderBuilder::addVarying(GrSLType type, const char* name, const char** vsOutName) { 48 void GrGLVertexShaderBuilder::addVarying(GrSLType type, const char* name, const char** vsOutName) {
51 fOutputs.push_back(); 49 fOutputs.push_back();
52 fOutputs.back().setType(type); 50 fOutputs.back().setType(type);
53 fOutputs.back().setTypeModifier(GrGLShaderVar::kVaryingOut_TypeModifier); 51 fOutputs.back().setTypeModifier(GrGLShaderVar::kVaryingOut_TypeModifier);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // order. This assumes that the drawState has not changed since we called fl ushGraphicsState() 86 // order. This assumes that the drawState has not changed since we called fl ushGraphicsState()
89 // higher up in the stack. 87 // higher up in the stack.
90 const GrDrawTargetCaps* caps = fProgramBuilder->gpu()->caps(); 88 const GrDrawTargetCaps* caps = fProgramBuilder->gpu()->caps();
91 const GrDrawState& drawState = *fProgramBuilder->gpu()->drawState(); 89 const GrDrawState& drawState = *fProgramBuilder->gpu()->drawState();
92 SkAutoTUnref<GrOptDrawState> optState(drawState.createOptState(*caps)); 90 SkAutoTUnref<GrOptDrawState> optState(drawState.createOptState(*caps));
93 const GrVertexAttrib* vaPtr = optState->getVertexAttribs(); 91 const GrVertexAttrib* vaPtr = optState->getVertexAttribs();
94 const int vaCount = optState->getVertexAttribCount(); 92 const int vaCount = optState->getVertexAttribCount();
95 93
96 int i = fEffectAttribOffset; 94 int i = fEffectAttribOffset;
97 for (int index = 0; index < vaCount; index++) { 95 for (int index = 0; index < vaCount; index++) {
98 if (kEffect_GrVertexAttribBinding != vaPtr[index].fBinding) { 96 if (kGeometryProcessor_GrVertexAttribBinding != vaPtr[index].fBinding) {
99 continue; 97 continue;
100 } 98 }
101 SkASSERT(index != header.fPositionAttributeIndex && 99 SkASSERT(index != header.fPositionAttributeIndex &&
102 index != header.fLocalCoordAttributeIndex && 100 index != header.fLocalCoordAttributeIndex &&
103 index != header.fColorAttributeIndex && 101 index != header.fColorAttributeIndex &&
104 index != header.fCoverageAttributeIndex); 102 index != header.fCoverageAttributeIndex);
105 // We should never find another effect attribute if we have bound everyt hing 103 // We should never find another effect attribute if we have bound everyt hing
106 SkASSERT(i < fInputs.count()); 104 SkASSERT(i < fInputs.count());
107 GL_CALL(BindAttribLocation(programId, index, fInputs[i].c_str())); 105 GL_CALL(BindAttribLocation(programId, index, fInputs[i].c_str()));
108 i++; 106 i++;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 this->addAttribute(GrShaderVar(coverage_attribute_name(), 193 this->addAttribute(GrShaderVar(coverage_attribute_name(),
196 kVec4f_GrSLType, 194 kVec4f_GrSLType,
197 GrShaderVar::kAttribute_TypeModifier)); 195 GrShaderVar::kAttribute_TypeModifier));
198 const char *vsName, *fsName; 196 const char *vsName, *fsName;
199 fFullProgramBuilder->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &f sName); 197 fFullProgramBuilder->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &f sName);
200 this->codeAppendf("%s = %s;", vsName, coverage_attribute_name()); 198 this->codeAppendf("%s = %s;", vsName, coverage_attribute_name());
201 *coverage = fsName; 199 *coverage = fsName;
202 } 200 }
203 fEffectAttribOffset = fInputs.count(); 201 fEffectAttribOffset = fInputs.count();
204 } 202 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLVertexShaderBuilder.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698