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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Transform from Skia's device coords to GL's normalized device coords. | 48 // Transform from Skia's device coords to GL's normalized device coords. |
49 this->codeAppendf("gl_Position = vec4(dot(%s.xz, %s.xy), dot(%s.yz, %s.zw),
0, %s.z);", | 49 this->codeAppendf("gl_Position = vec4(dot(%s.xz, %s.xy), dot(%s.yz, %s.zw),
0, %s.z);", |
50 pos3, fRtAdjustName, pos3, fRtAdjustName, pos3); | 50 pos3, fRtAdjustName, pos3, fRtAdjustName, pos3); |
51 | 51 |
52 // We could have the GrGeometryProcessor do this, but its just easier to hav
e it performed here. | 52 // We could have the GrGeometryProcessor do this, but its just easier to hav
e it performed here. |
53 // If we ever need to set variable pointsize, then we can reinvestigate | 53 // If we ever need to set variable pointsize, then we can reinvestigate |
54 this->codeAppend("gl_PointSize = 1.0;"); | 54 this->codeAppend("gl_PointSize = 1.0;"); |
55 } | 55 } |
56 | 56 |
57 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { | 57 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { |
58 const GrGeometryProcessor* gp = fProgramBuilder->fOptState.getGeometryProces
sor(); | 58 const GrPrimitiveProcessor* primProc = fProgramBuilder->fOptState.getPrimiti
veProcessor(); |
59 | 59 |
60 const GrGeometryProcessor::VertexAttribArray& v = gp->getAttribs(); | 60 const GrGeometryProcessor::VertexAttribArray& v = primProc->getAttribs(); |
61 int vaCount = v.count(); | 61 int vaCount = v.count(); |
62 for (int i = 0; i < vaCount; i++) { | 62 for (int i = 0; i < vaCount; i++) { |
63 GL_CALL(BindAttribLocation(programID, i, v[i].fName)); | 63 GL_CALL(BindAttribLocation(programID, i, v[i].fName)); |
64 } | 64 } |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, | 68 bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, |
69 SkTDArray<GrGLuint>* shaderIds) const { | 69 SkTDArray<GrGLuint>* shaderIds) const { |
70 GrGLGpu* gpu = fProgramBuilder->gpu(); | 70 GrGLGpu* gpu = fProgramBuilder->gpu(); |
(...skipping 21 matching lines...) Expand all Loading... |
92 for (int i = 0; i < fInputs.count(); ++i) { | 92 for (int i = 0; i < fInputs.count(); ++i) { |
93 const GrGLShaderVar& attr = fInputs[i]; | 93 const GrGLShaderVar& attr = fInputs[i]; |
94 // if attribute already added, don't add it again | 94 // if attribute already added, don't add it again |
95 if (attr.getName().equals(var.getName())) { | 95 if (attr.getName().equals(var.getName())) { |
96 return false; | 96 return false; |
97 } | 97 } |
98 } | 98 } |
99 fInputs.push_back(var); | 99 fInputs.push_back(var); |
100 return true; | 100 return true; |
101 } | 101 } |
OLD | NEW |