| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 "rtAdjustment", | 91 "rtAdjustment", |
| 92 &rtAdjustName); | 92 &rtAdjustName); |
| 93 | 93 |
| 94 // Transform from Skia's device coords to GL's normalized device coords. | 94 // Transform from Skia's device coords to GL's normalized device coords. |
| 95 this->codeAppendf("gl_Position = vec4(dot(pos3.xz, %s.xy), dot(pos3.yz, %s.z
w), 0, pos3.z);", | 95 this->codeAppendf("gl_Position = vec4(dot(pos3.xz, %s.xy), dot(pos3.yz, %s.z
w), 0, pos3.z);", |
| 96 rtAdjustName, rtAdjustName); | 96 rtAdjustName, rtAdjustName); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { | 99 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { |
| 100 // Bind the attrib locations to same values for all shaders | 100 // Bind the attrib locations to same values for all shaders |
| 101 const GrGLProgramDesc::KeyHeader& header = fProgramBuilder->header(); | 101 const GrProgramDesc::KeyHeader& header = fProgramBuilder->header(); |
| 102 SkASSERT(-1 != header.fPositionAttributeIndex); | 102 SkASSERT(-1 != header.fPositionAttributeIndex); |
| 103 GL_CALL(BindAttribLocation(programID, | 103 GL_CALL(BindAttribLocation(programID, |
| 104 header.fPositionAttributeIndex, | 104 header.fPositionAttributeIndex, |
| 105 fPositionVar->c_str())); | 105 fPositionVar->c_str())); |
| 106 if (-1 != header.fLocalCoordAttributeIndex) { | 106 if (-1 != header.fLocalCoordAttributeIndex) { |
| 107 GL_CALL(BindAttribLocation(programID, | 107 GL_CALL(BindAttribLocation(programID, |
| 108 header.fLocalCoordAttributeIndex, | 108 header.fLocalCoordAttributeIndex, |
| 109 fLocalCoordsVar->c_str())); | 109 fLocalCoordsVar->c_str())); |
| 110 } | 110 } |
| 111 if (-1 != header.fColorAttributeIndex) { | 111 if (-1 != header.fColorAttributeIndex) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 for (int i = 0; i < fInputs.count(); ++i) { | 169 for (int i = 0; i < fInputs.count(); ++i) { |
| 170 const GrGLShaderVar& attr = fInputs[i]; | 170 const GrGLShaderVar& attr = fInputs[i]; |
| 171 // if attribute already added, don't add it again | 171 // if attribute already added, don't add it again |
| 172 if (attr.getName().equals(var.getName())) { | 172 if (attr.getName().equals(var.getName())) { |
| 173 return false; | 173 return false; |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 fInputs.push_back(var); | 176 fInputs.push_back(var); |
| 177 return true; | 177 return true; |
| 178 } | 178 } |
| OLD | NEW |