| 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" |
| 11 #include "../GrGLGpu.h" | 11 #include "../GrGLGpu.h" |
| 12 | 12 |
| 13 #define GL_CALL(X) GR_GL_CALL(fProgramBuilder->gpu()->glInterface(), X) | 13 #define GL_CALL(X) GR_GL_CALL(fProgramBuilder->gpu()->glInterface(), X) |
| 14 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fProgramBuilder->gpu()->glInterface(),
R, X) | 14 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fProgramBuilder->gpu()->glInterface(),
R, X) |
| 15 | 15 |
| 16 GrGLVertexBuilder::GrGLVertexBuilder(GrGLProgramBuilder* program) | 16 GrGLVertexBuilder::GrGLVertexBuilder(GrGLProgramBuilder* program) |
| 17 : INHERITED(program) | 17 : INHERITED(program) |
| 18 , fRtAdjustName(NULL) { | 18 , fRtAdjustName(NULL) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 void GrGLVertexBuilder::addVarying(const char* name, GrGLVarying* v) { | 21 void GrGLVertexBuilder::addVarying(const char* name, GrGLVarying* v) { |
| 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() { | |
| 30 fProgramBuilder->fUniformHandles.fViewMatrixUni = | |
| 31 fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility, | |
| 32 kMat33f_GrSLType, kDefault_GrSLPrecision
, | |
| 33 this->uViewM()); | |
| 34 } | |
| 35 | |
| 36 void GrGLVertexBuilder::emitAttributes(const GrGeometryProcessor& gp) { | 29 void GrGLVertexBuilder::emitAttributes(const GrGeometryProcessor& gp) { |
| 37 const GrGeometryProcessor::VertexAttribArray& v = gp.getAttribs(); | 30 const GrGeometryProcessor::VertexAttribArray& v = gp.getAttribs(); |
| 38 int vaCount = v.count(); | 31 int vaCount = v.count(); |
| 39 for (int i = 0; i < vaCount; i++) { | 32 for (int i = 0; i < vaCount; i++) { |
| 40 this->addAttribute(&v[i]); | 33 this->addAttribute(&v[i]); |
| 41 } | 34 } |
| 42 return; | 35 return; |
| 43 } | 36 } |
| 44 | 37 |
| 45 void GrGLVertexBuilder::transformToNormalizedDeviceSpace() { | 38 void GrGLVertexBuilder::transformToNormalizedDeviceSpace() { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 for (int i = 0; i < fInputs.count(); ++i) { | 121 for (int i = 0; i < fInputs.count(); ++i) { |
| 129 const GrGLShaderVar& attr = fInputs[i]; | 122 const GrGLShaderVar& attr = fInputs[i]; |
| 130 // if attribute already added, don't add it again | 123 // if attribute already added, don't add it again |
| 131 if (attr.getName().equals(var.getName())) { | 124 if (attr.getName().equals(var.getName())) { |
| 132 return false; | 125 return false; |
| 133 } | 126 } |
| 134 } | 127 } |
| 135 fInputs.push_back(var); | 128 fInputs.push_back(var); |
| 136 return true; | 129 return true; |
| 137 } | 130 } |
| OLD | NEW |