OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "glsl/GrGLSLVarying.h" | 8 #include "glsl/GrGLSLVarying.h" |
9 | 9 |
10 #include "glsl/GrGLSLProgramBuilder.h" | 10 #include "glsl/GrGLSLProgramBuilder.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 for (int j = 0; j < fVertexInputs.count(); ++j) { | 98 for (int j = 0; j < fVertexInputs.count(); ++j) { |
99 const GrGLSLShaderVar& attr = fVertexInputs[j]; | 99 const GrGLSLShaderVar& attr = fVertexInputs[j]; |
100 // if attribute already added, don't add it again | 100 // if attribute already added, don't add it again |
101 if (attr.getName().equals(var.getName())) { | 101 if (attr.getName().equals(var.getName())) { |
102 return; | 102 return; |
103 } | 103 } |
104 } | 104 } |
105 fVertexInputs.push_back(var); | 105 fVertexInputs.push_back(var); |
106 } | 106 } |
107 | 107 |
| 108 void GrGLSLVaryingHandler::finalize() { |
| 109 this->onFinalize(); |
| 110 } |
| 111 |
108 void GrGLSLVaryingHandler::appendDecls(const VarArray& vars, SkString* out) cons
t { | 112 void GrGLSLVaryingHandler::appendDecls(const VarArray& vars, SkString* out) cons
t { |
109 for (int i = 0; i < vars.count(); ++i) { | 113 for (int i = 0; i < vars.count(); ++i) { |
110 vars[i].appendDecl(fProgramBuilder->glslCaps(), out); | 114 vars[i].appendDecl(fProgramBuilder->glslCaps(), out); |
111 out->append(";"); | 115 out->append(";"); |
112 } | 116 } |
113 } | 117 } |
114 | 118 |
115 void GrGLSLVaryingHandler::getVertexDecls(SkString* inputDecls, SkString* output
Decls) const { | 119 void GrGLSLVaryingHandler::getVertexDecls(SkString* inputDecls, SkString* output
Decls) const { |
116 this->appendDecls(fVertexInputs, inputDecls); | 120 this->appendDecls(fVertexInputs, inputDecls); |
117 this->appendDecls(fVertexOutputs, outputDecls); | 121 this->appendDecls(fVertexOutputs, outputDecls); |
118 } | 122 } |
119 | 123 |
120 void GrGLSLVaryingHandler::getGeomDecls(SkString* inputDecls, SkString* outputDe
cls) const { | 124 void GrGLSLVaryingHandler::getGeomDecls(SkString* inputDecls, SkString* outputDe
cls) const { |
121 this->appendDecls(fGeomInputs, inputDecls); | 125 this->appendDecls(fGeomInputs, inputDecls); |
122 this->appendDecls(fGeomOutputs, outputDecls); | 126 this->appendDecls(fGeomOutputs, outputDecls); |
123 } | 127 } |
124 | 128 |
125 void GrGLSLVaryingHandler::getFragDecls(SkString* inputDecls, SkString* outputDe
cls) const { | 129 void GrGLSLVaryingHandler::getFragDecls(SkString* inputDecls, SkString* outputDe
cls) const { |
126 // We should not have any outputs in the fragment shader when using version
1.10 | 130 // We should not have any outputs in the fragment shader when using version
1.10 |
127 SkASSERT(k110_GrGLSLGeneration != fProgramBuilder->glslCaps()->generation()
|| | 131 SkASSERT(k110_GrGLSLGeneration != fProgramBuilder->glslCaps()->generation()
|| |
128 fFragOutputs.empty()); | 132 fFragOutputs.empty()); |
129 this->appendDecls(fFragInputs, inputDecls); | 133 this->appendDecls(fFragInputs, inputDecls); |
130 this->appendDecls(fFragOutputs, outputDecls); | 134 this->appendDecls(fFragOutputs, outputDecls); |
131 } | 135 } |
132 | 136 |
OLD | NEW |