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