| 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 "GrGLGeometryShaderBuilder.h" |
| 9 #include "GrGLProgramBuilder.h" | 9 #include "GrGLProgramBuilder.h" |
| 10 #include "../GrGLGpu.h" | 10 #include "../GrGLGpu.h" |
| 11 | 11 |
| 12 GrGLGeometryBuilder::GrGLGeometryBuilder(GrGLProgramBuilder* program) | 12 GrGLGeometryBuilder::GrGLGeometryBuilder(GrGLProgramBuilder* program) |
| 13 : INHERITED(program) { | 13 : INHERITED(program) { |
| 14 | 14 |
| 15 } | 15 } |
| 16 | 16 |
| 17 void GrGLGeometryBuilder::addVarying(const char* name, GrGLVarying* v) { | 17 void GrGLGeometryBuilder::addVarying(const char* name, GrSLPrecision precision,
GrGLVarying* v) { |
| 18 // if we have a GS take each varying in as an array | 18 // if we have a GS take each varying in as an array |
| 19 // and output as non-array. | 19 // and output as non-array. |
| 20 if (v->vsVarying()) { | 20 if (v->vsVarying()) { |
| 21 fInputs.push_back(); | 21 fInputs.push_back(); |
| 22 fInputs.back().setType(v->fType); | 22 fInputs.back().setType(v->fType); |
| 23 fInputs.back().setTypeModifier(GrGLShaderVar::kVaryingIn_TypeModifier); | 23 fInputs.back().setTypeModifier(GrGLShaderVar::kVaryingIn_TypeModifier); |
| 24 fInputs.back().setPrecision(precision); |
| 24 fInputs.back().setUnsizedArray(); | 25 fInputs.back().setUnsizedArray(); |
| 25 *fInputs.back().accessName() = v->fVsOut; | 26 *fInputs.back().accessName() = v->fVsOut; |
| 26 v->fGsIn = v->fVsOut; | 27 v->fGsIn = v->fVsOut; |
| 27 } | 28 } |
| 28 | 29 |
| 29 if (v->fsVarying()) { | 30 if (v->fsVarying()) { |
| 30 fOutputs.push_back(); | 31 fOutputs.push_back(); |
| 31 fOutputs.back().setType(v->fType); | 32 fOutputs.back().setType(v->fType); |
| 32 fOutputs.back().setTypeModifier(GrGLShaderVar::kVaryingOut_TypeModifier)
; | 33 fOutputs.back().setTypeModifier(GrGLShaderVar::kVaryingOut_TypeModifier)
; |
| 34 fOutputs.back().setPrecision(precision); |
| 33 fProgramBuilder->nameVariable(fOutputs.back().accessName(), 'g', name); | 35 fProgramBuilder->nameVariable(fOutputs.back().accessName(), 'g', name); |
| 34 v->fGsOut = fOutputs.back().getName().c_str(); | 36 v->fGsOut = fOutputs.back().getName().c_str(); |
| 35 } | 37 } |
| 36 } | 38 } |
| 37 | 39 |
| 38 bool GrGLGeometryBuilder::compileAndAttachShaders(GrGLuint programId, | 40 bool GrGLGeometryBuilder::compileAndAttachShaders(GrGLuint programId, |
| 39 SkTDArray<GrGLuint>* shaderIds) { | 41 SkTDArray<GrGLuint>* shaderIds) { |
| 40 SkFAIL("Geometry shaders are not currently supported"); | 42 SkFAIL("Geometry shaders are not currently supported"); |
| 41 return false; | 43 return false; |
| 42 } | 44 } |
| OLD | NEW |