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

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

Issue 554833002: Calculate Primary and Secondary output types in the GrOptDrawState (Closed) Base URL: https://skia.googlesource.com/skia.git@optReadDst
Patch Set: Rebase Created 6 years, 3 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
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 if (-1 != header.fCoverageAttributeIndex) { 81 if (-1 != header.fCoverageAttributeIndex) {
82 GL_CALL(BindAttribLocation(programId, 82 GL_CALL(BindAttribLocation(programId,
83 header.fCoverageAttributeIndex, 83 header.fCoverageAttributeIndex,
84 coverage_attribute_name())); 84 coverage_attribute_name()));
85 } 85 }
86 86
87 // We pull the current state of attributes off of drawstate's optimized stat e and bind them in 87 // We pull the current state of attributes off of drawstate's optimized stat e and bind them in
88 // order. This assumes that the drawState has not changed since we called fl ushGraphicsState() 88 // order. This assumes that the drawState has not changed since we called fl ushGraphicsState()
89 // higher up in the stack. 89 // higher up in the stack.
90 SkAutoTUnref<GrOptDrawState> optState(fProgramBuilder->gpu()->drawState()->c reateOptState()); 90 const GrDrawTargetCaps& caps = *fProgramBuilder->gpu()->caps();
91 SkAutoTUnref<GrOptDrawState> optState(fProgramBuilder->gpu()->drawState()->c reateOptState(caps));
91 const GrVertexAttrib* vaPtr = optState->getVertexAttribs(); 92 const GrVertexAttrib* vaPtr = optState->getVertexAttribs();
92 const int vaCount = optState->getVertexAttribCount(); 93 const int vaCount = optState->getVertexAttribCount();
93 94
94 int i = fEffectAttribOffset; 95 int i = fEffectAttribOffset;
95 for (int index = 0; index < vaCount; index++) { 96 for (int index = 0; index < vaCount; index++) {
96 if (kEffect_GrVertexAttribBinding != vaPtr[index].fBinding) { 97 if (kEffect_GrVertexAttribBinding != vaPtr[index].fBinding) {
97 continue; 98 continue;
98 } 99 }
99 SkASSERT(index != header.fPositionAttributeIndex && 100 SkASSERT(index != header.fPositionAttributeIndex &&
100 index != header.fLocalCoordAttributeIndex && 101 index != header.fLocalCoordAttributeIndex &&
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 this->addAttribute(GrShaderVar(coverage_attribute_name(), 193 this->addAttribute(GrShaderVar(coverage_attribute_name(),
193 kVec4f_GrSLType, 194 kVec4f_GrSLType,
194 GrShaderVar::kAttribute_TypeModifier)); 195 GrShaderVar::kAttribute_TypeModifier));
195 const char *vsName, *fsName; 196 const char *vsName, *fsName;
196 fFullProgramBuilder->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &f sName); 197 fFullProgramBuilder->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &f sName);
197 this->codeAppendf("\t%s = %s;\n", vsName, coverage_attribute_name()); 198 this->codeAppendf("\t%s = %s;\n", vsName, coverage_attribute_name());
198 *coverage = fsName; 199 *coverage = fsName;
199 } 200 }
200 fEffectAttribOffset = fInputs.count(); 201 fEffectAttribOffset = fInputs.count();
201 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698