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 "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 Loading... |
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 Loading... |
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 } |
OLD | NEW |