| 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 "GrGLProgramBuilder.h" | 9 #include "GrGLProgramBuilder.h" |
| 10 #include "GrGLShaderStringBuilder.h" | 10 #include "GrGLShaderStringBuilder.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 fOutputs.push_back(); | 22 fOutputs.push_back(); |
| 23 fOutputs.back().setType(v->fType); | 23 fOutputs.back().setType(v->fType); |
| 24 fOutputs.back().setTypeModifier(GrGLShaderVar::kVaryingOut_TypeModifier); | 24 fOutputs.back().setTypeModifier(GrGLShaderVar::kVaryingOut_TypeModifier); |
| 25 fProgramBuilder->nameVariable(fOutputs.back().accessName(), 'v', name); | 25 fProgramBuilder->nameVariable(fOutputs.back().accessName(), 'v', name); |
| 26 v->fVsOut = fOutputs.back().getName().c_str(); | 26 v->fVsOut = fOutputs.back().getName().c_str(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void GrGLVertexBuilder::setupUniformViewMatrix() { | 29 void GrGLVertexBuilder::setupUniformViewMatrix() { |
| 30 fProgramBuilder->fUniformHandles.fViewMatrixUni = | 30 fProgramBuilder->fUniformHandles.fViewMatrixUni = |
| 31 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility, | 31 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility, |
| 32 kMat33f_GrSLType, | 32 kMat33f_GrSLType, kDefault_GrSLPrecision
, |
| 33 this->uViewM()); | 33 this->uViewM()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void GrGLVertexBuilder::emitAttributes(const GrGeometryProcessor& gp) { | 36 void GrGLVertexBuilder::emitAttributes(const GrGeometryProcessor& gp) { |
| 37 const GrGeometryProcessor::VertexAttribArray& v = gp.getAttribs(); | 37 const GrGeometryProcessor::VertexAttribArray& v = gp.getAttribs(); |
| 38 int vaCount = v.count(); | 38 int vaCount = v.count(); |
| 39 for (int i = 0; i < vaCount; i++) { | 39 for (int i = 0; i < vaCount; i++) { |
| 40 this->addAttribute(&v[i]); | 40 this->addAttribute(&v[i]); |
| 41 } | 41 } |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void GrGLVertexBuilder::transformToNormalizedDeviceSpace() { | 45 void GrGLVertexBuilder::transformToNormalizedDeviceSpace() { |
| 46 // setup RT Uniform | 46 // setup RT Uniform |
| 47 fProgramBuilder->fUniformHandles.fRTAdjustmentUni = | 47 fProgramBuilder->fUniformHandles.fRTAdjustmentUni = |
| 48 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility, | 48 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility, |
| 49 kVec4f_GrSLType, | 49 kVec4f_GrSLType, kDefault_GrSLPrecision, |
| 50 fProgramBuilder->rtAdjustment(), | 50 fProgramBuilder->rtAdjustment(), |
| 51 &fRtAdjustName); | 51 &fRtAdjustName); |
| 52 // Wire transforms | 52 // Wire transforms |
| 53 SkTArray<GrGLProgramBuilder::TransformVarying, true>& transVs = fProgramBuil
der->fCoordVaryings; | 53 SkTArray<GrGLProgramBuilder::TransformVarying, true>& transVs = fProgramBuil
der->fCoordVaryings; |
| 54 int transformCount = transVs.count(); | 54 int transformCount = transVs.count(); |
| 55 for (int i = 0; i < transformCount; i++) { | 55 for (int i = 0; i < transformCount; i++) { |
| 56 const char* coords = transVs[i].fSourceCoords.c_str(); | 56 const char* coords = transVs[i].fSourceCoords.c_str(); |
| 57 | 57 |
| 58 // varying = matrix * coords (logically) | 58 // varying = matrix * coords (logically) |
| 59 const GrGLVarying& v = transVs[i].fV; | 59 const GrGLVarying& v = transVs[i].fV; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 for (int i = 0; i < fInputs.count(); ++i) { | 110 for (int i = 0; i < fInputs.count(); ++i) { |
| 111 const GrGLShaderVar& attr = fInputs[i]; | 111 const GrGLShaderVar& attr = fInputs[i]; |
| 112 // if attribute already added, don't add it again | 112 // if attribute already added, don't add it again |
| 113 if (attr.getName().equals(var.getName())) { | 113 if (attr.getName().equals(var.getName())) { |
| 114 return false; | 114 return false; |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 fInputs.push_back(var); | 117 fInputs.push_back(var); |
| 118 return true; | 118 return true; |
| 119 } | 119 } |
| OLD | NEW |