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

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, 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/GrGLFragmentShaderBuilder.cpp ('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 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 const GrDrawState& drawState = *fProgramBuilder->gpu()->drawState();
92 SkAutoTUnref<GrOptDrawState> optState(drawState.createOptState(*caps));
91 const GrVertexAttrib* vaPtr = optState->getVertexAttribs(); 93 const GrVertexAttrib* vaPtr = optState->getVertexAttribs();
92 const int vaCount = optState->getVertexAttribCount(); 94 const int vaCount = optState->getVertexAttribCount();
93 95
94 int i = fEffectAttribOffset; 96 int i = fEffectAttribOffset;
95 for (int index = 0; index < vaCount; index++) { 97 for (int index = 0; index < vaCount; index++) {
96 if (kEffect_GrVertexAttribBinding != vaPtr[index].fBinding) { 98 if (kEffect_GrVertexAttribBinding != vaPtr[index].fBinding) {
97 continue; 99 continue;
98 } 100 }
99 SkASSERT(index != header.fPositionAttributeIndex && 101 SkASSERT(index != header.fPositionAttributeIndex &&
100 index != header.fLocalCoordAttributeIndex && 102 index != header.fLocalCoordAttributeIndex &&
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 this->addAttribute(GrShaderVar(coverage_attribute_name(), 195 this->addAttribute(GrShaderVar(coverage_attribute_name(),
194 kVec4f_GrSLType, 196 kVec4f_GrSLType,
195 GrShaderVar::kAttribute_TypeModifier)); 197 GrShaderVar::kAttribute_TypeModifier));
196 const char *vsName, *fsName; 198 const char *vsName, *fsName;
197 fFullProgramBuilder->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &f sName); 199 fFullProgramBuilder->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &f sName);
198 this->codeAppendf("%s = %s;", vsName, coverage_attribute_name()); 200 this->codeAppendf("%s = %s;", vsName, coverage_attribute_name());
199 *coverage = fsName; 201 *coverage = fsName;
200 } 202 }
201 fEffectAttribOffset = fInputs.count(); 203 fEffectAttribOffset = fInputs.count();
202 } 204 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698