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 "GrGLGeometryShaderBuilder.h" | 8 #include "GrGLSLGeometryShaderBuilder.h" |
9 #include "GrGLProgramBuilder.h" | 9 #include "GrGLSLProgramBuilder.h" |
10 #include "../GrGLGpu.h" | |
11 | 10 |
12 GrGLGeometryBuilder::GrGLGeometryBuilder(GrGLSLProgramBuilder* program) | 11 GrGLSLGeometryBuilder::GrGLSLGeometryBuilder(GrGLSLProgramBuilder* program) |
13 : INHERITED(program) { | 12 : INHERITED(program) { |
14 | 13 |
15 } | 14 } |
16 | 15 |
17 void GrGLGeometryBuilder::addVarying(const char* name, GrSLPrecision precision,
GrGLSLVarying* v) { | 16 void GrGLSLGeometryBuilder::addVarying(const char* name, |
| 17 GrSLPrecision precision, |
| 18 GrGLSLVarying* v) { |
18 // if we have a GS take each varying in as an array | 19 // if we have a GS take each varying in as an array |
19 // and output as non-array. | 20 // and output as non-array. |
20 if (v->vsVarying()) { | 21 if (v->vsVarying()) { |
21 fInputs.push_back(); | 22 fInputs.push_back(); |
22 fInputs.back().setType(v->fType); | 23 fInputs.back().setType(v->fType); |
23 fInputs.back().setTypeModifier(GrGLSLShaderVar::kVaryingIn_TypeModifier)
; | 24 fInputs.back().setTypeModifier(GrGLSLShaderVar::kVaryingIn_TypeModifier)
; |
24 fInputs.back().setPrecision(precision); | 25 fInputs.back().setPrecision(precision); |
25 fInputs.back().setUnsizedArray(); | 26 fInputs.back().setUnsizedArray(); |
26 *fInputs.back().accessName() = v->fVsOut; | 27 *fInputs.back().accessName() = v->fVsOut; |
27 v->fGsIn = v->fVsOut; | 28 v->fGsIn = v->fVsOut; |
28 } | 29 } |
29 | 30 |
30 if (v->fsVarying()) { | 31 if (v->fsVarying()) { |
31 fOutputs.push_back(); | 32 fOutputs.push_back(); |
32 fOutputs.back().setType(v->fType); | 33 fOutputs.back().setType(v->fType); |
33 fOutputs.back().setTypeModifier(GrGLSLShaderVar::kVaryingOut_TypeModifie
r); | 34 fOutputs.back().setTypeModifier(GrGLSLShaderVar::kVaryingOut_TypeModifie
r); |
34 fOutputs.back().setPrecision(precision); | 35 fOutputs.back().setPrecision(precision); |
35 fProgramBuilder->nameVariable(fOutputs.back().accessName(), 'g', name); | 36 fProgramBuilder->nameVariable(fOutputs.back().accessName(), 'g', name); |
36 v->fGsOut = fOutputs.back().getName().c_str(); | 37 v->fGsOut = fOutputs.back().getName().c_str(); |
37 } | 38 } |
38 } | 39 } |
39 | 40 |
OLD | NEW |